Re: [PATCH v5 10/17] rtc: rzn1: Replace remove callback with devm_add_action_or_reset()

Wolfram Sang <[email protected]>
Newsgroups org.kernel.vger.linux-rtc,dev.linux.lists.sashiko-reviews,org.kernel.vger.linux-devicetree
Message-ID <aohrp9dtVTAg8sVj@ninjato>
> > +	ret = devm_add_action_or_reset(&pdev->dev, rzn1_rtc_disable_hardware, &pdev->dev);
> > +	if (ret)
> > +		return ret;
> > +
> 
> [Severity: High]
> Since devres executes teardown actions in LIFO order, will registering the
> hardware disable action here early in rzn1_rtc_probe cause it to run last
> during driver unbind?
> 
> [ ... ]
> 
> > @@ -468,14 +480,12 @@ static int rzn1_rtc_probe(struct platform_device *pdev)
> >  	ret = devm_request_irq(&pdev->dev, irq, rzn1_rtc_alarm_irq, 0, "RZN1 RTC Alarm", rtc);
> >  	if (ret) {
> >  		dev_err(&pdev->dev, "RTC alarm interrupt not available\n");
> > -		goto dis_runtime_pm;
> > +		return ret;
> >  	}
> 
> [Severity: High]
> If devm_request_irq is called after the hardware disable action is
> registered, won't the IRQ handlers be freed before the hardware is disabled
> during teardown?
> 
> If an RTC alarm or 1-second interrupt is active when the driver unbinds,
> could an interrupt fire in the devres teardown window where the handler is
> gone but the hardware is still active? This might trigger the generic IRQ
> subsystem's spurious interrupt detector, which could permanently disable the
> IRQ line.

This needs to be checked, I am afraid. It sounds reasonable.
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEOZGx6rniZ1Gk92RdFA3kzBSgKbYFAmqIa6cACgkQFA3kzBSg
KbbjbA/9GjGrjSbxpVZA5XNA6QLp8S2MRsDNo0mGJ/jFVWGPHSm18FsMvv2MxBZd
3pkTUoTtLCxbPhA38umc6KDf+iHz48ow++JzAr2CmxBchToXpPDVH3RmVEgWyD/Y
7+OU7dRST6ChqiOPEVf/XcGGM2rtTS/b6dJe6nKDMGvcTtRiFtnPibkjaKlmmFeP
pKORVErq09hL+iCgBknywjB699+BuRVbpxvsUvVYbtbdNCylzCjEgsfEDwTiJ0ZP
V1EoKWhszS41Pl/fPVj4nJyag03s7Lx8jmoaRkWtyWHrnHttMm5ckrFSzD0rnlMw
9m7R3lTG66QDs19E1kd5AWuE6Fn/tV6fsfl/uwiCo+16YUZjLVr3XOLtUVeecwiA
g3n9HolVGEXGprXDEm/g8QlngYSpkPerWpqbjybAFR2iXe561x2imi+17Lzb52yU
mB2ZPWQk/d+WSA65MaIV8ZTaI/e7JCQAv7RQcF1wNKKPyOgxA8WoomxgcAQbDuwR
u115ZnS+jdB/k4B1J3kfdB6Yd6Vxl3UUwWJfZKLAQwitlD988qOWqrxixUnqp6D6
dkM95157g707FGUxB708z4zy6e+TJeKABv67pXsPW/5Ch1Z2Qbrnpc3vlCXbzrGv
agjD2qvhQzav7JE2YOSnfxx2hP4Z2pGfv9zdDzVBT2AaKQYnss0=
=2V3P
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.