diff mbox series

fbdev: da8xx-fb: Fix error handling in .remove()

Message ID 20221017195250.1425468-1-u.kleine-koenig@pengutronix.de (mailing list archive)
State Accepted, archived
Headers show
Series fbdev: da8xx-fb: Fix error handling in .remove() | expand

Commit Message

Uwe Kleine-König Oct. 17, 2022, 7:52 p.m. UTC
Even in the presence of problems (here: regulator_disable() might fail),
it's important to unregister all resources acquired during .probe() and
disable the device (i.e. DMA activity) because even if .remove() returns
an error code, the device is removed and the .remove() callback is never
called again later to catch up.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/video/fbdev/da8xx-fb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


base-commit: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f

Comments

Helge Deller Oct. 18, 2022, 6:08 a.m. UTC | #1
On 10/17/22 21:52, Uwe Kleine-König wrote:
> Even in the presence of problems (here: regulator_disable() might fail),
> it's important to unregister all resources acquired during .probe() and
> disable the device (i.e. DMA activity) because even if .remove() returns
> an error code, the device is removed and the .remove() callback is never
> called again later to catch up.
>
> This is a preparation for making platform remove callbacks return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

applied.

Thanks!
Helge

> ---
>   drivers/video/fbdev/da8xx-fb.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
> index ae76a2111c77..11922b009ed7 100644
> --- a/drivers/video/fbdev/da8xx-fb.c
> +++ b/drivers/video/fbdev/da8xx-fb.c
> @@ -1076,7 +1076,8 @@ static int fb_remove(struct platform_device *dev)
>   	if (par->lcd_supply) {
>   		ret = regulator_disable(par->lcd_supply);
>   		if (ret)
> -			return ret;
> +			dev_warn(&dev->dev, "Failed to disable regulator (%pe)\n",
> +				 ERR_PTR(ret));
>   	}
>
>   	lcd_disable_raster(DA8XX_FRAME_WAIT);
>
> base-commit: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f
Uwe Kleine-König Oct. 18, 2022, 7:22 a.m. UTC | #2
On Tue, Oct 18, 2022 at 08:08:49AM +0200, Helge Deller wrote:
> On 10/17/22 21:52, Uwe Kleine-König wrote:
> > Even in the presence of problems (here: regulator_disable() might fail),
> > it's important to unregister all resources acquired during .probe() and
> > disable the device (i.e. DMA activity) because even if .remove() returns
> > an error code, the device is removed and the .remove() callback is never
> > called again later to catch up.
> > 
> > This is a preparation for making platform remove callbacks return void.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> applied.

Great. If you want a Fixes: line, that's:

Fixes: 611097d5daea ("fbdev: da8xx: add support for a regulator")

(expanded Cc: a bit with the people involved there.)

Best regards
Uwe

> > ---
> >   drivers/video/fbdev/da8xx-fb.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
> > index ae76a2111c77..11922b009ed7 100644
> > --- a/drivers/video/fbdev/da8xx-fb.c
> > +++ b/drivers/video/fbdev/da8xx-fb.c
> > @@ -1076,7 +1076,8 @@ static int fb_remove(struct platform_device *dev)
> >   	if (par->lcd_supply) {
> >   		ret = regulator_disable(par->lcd_supply);
> >   		if (ret)
> > -			return ret;
> > +			dev_warn(&dev->dev, "Failed to disable regulator (%pe)\n",
> > +				 ERR_PTR(ret));
> >   	}
> > 
> >   	lcd_disable_raster(DA8XX_FRAME_WAIT);
> > 
> > base-commit: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f
> 
> 
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c
index ae76a2111c77..11922b009ed7 100644
--- a/drivers/video/fbdev/da8xx-fb.c
+++ b/drivers/video/fbdev/da8xx-fb.c
@@ -1076,7 +1076,8 @@  static int fb_remove(struct platform_device *dev)
 	if (par->lcd_supply) {
 		ret = regulator_disable(par->lcd_supply);
 		if (ret)
-			return ret;
+			dev_warn(&dev->dev, "Failed to disable regulator (%pe)\n",
+				 ERR_PTR(ret));
 	}
 
 	lcd_disable_raster(DA8XX_FRAME_WAIT);