[PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void

Nicolas Ferre nicolas.ferre at microchip.com
Mon Apr 3 01:37:40 PDT 2023


On 01/04/2023 at 18:18, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is (mostly) ignored
> and this typically results in resource leaks. To improve here there is a
> quest to make the remove callback return void. In the first step of this
> quest all drivers are converted to .remove_new() which already returns
> void.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>

Ok for me:
Acked-by: Nicolas Ferre <nicolas.ferre at microchip.com>

Thanks Uwe for having taken care of this driver. Best regards,
   Nicolas

> ---
>   drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index 41c6bd6e2d72..81e3d682a8cd 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -2626,13 +2626,11 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
>          return caps->ops->probe(pdev, caps);
>   }
> 
> -static int atmel_nand_controller_remove(struct platform_device *pdev)
> +static void atmel_nand_controller_remove(struct platform_device *pdev)
>   {
>          struct atmel_nand_controller *nc = platform_get_drvdata(pdev);
> 
>          WARN_ON(nc->caps->ops->remove(nc));
> -
> -       return 0;
>   }
> 
>   static __maybe_unused int atmel_nand_controller_resume(struct device *dev)
> @@ -2663,7 +2661,7 @@ static struct platform_driver atmel_nand_controller_driver = {
>                  .pm = &atmel_nand_controller_pm_ops,
>          },
>          .probe = atmel_nand_controller_probe,
> -       .remove = atmel_nand_controller_remove,
> +       .remove_new = atmel_nand_controller_remove,
>   };
>   module_platform_driver(atmel_nand_controller_driver);
> 
> --
> 2.39.2
> 

-- 
Nicolas Ferre




More information about the linux-mtd mailing list