[PATCH 23/53] drm/ingenic: Convert to platform remove callback returning void

Paul Cercueil paul at crapouillou.net
Sun May 7 18:46:33 UTC 2023


Hi,

Le dimanche 07 mai 2023 à 18:25 +0200, Uwe Kleine-König a écrit :
> 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 the ingenic drm drivers 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>

Reviewed-by: Paul Cercueil <paul at crapouillou.net>

Cheers,
-Paul

> ---
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 6 ++----
>  drivers/gpu/drm/ingenic/ingenic-ipu.c     | 5 ++---
>  2 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 5ec75e9ba499..4a22b7465080 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -1449,7 +1449,7 @@ static int ingenic_drm_probe(struct
> platform_device *pdev)
>         return component_master_add_with_match(dev,
> &ingenic_master_ops, match);
>  }
>  
> -static int ingenic_drm_remove(struct platform_device *pdev)
> +static void ingenic_drm_remove(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>  
> @@ -1457,8 +1457,6 @@ static int ingenic_drm_remove(struct
> platform_device *pdev)
>                 ingenic_drm_unbind(dev);
>         else
>                 component_master_del(dev, &ingenic_master_ops);
> -
> -       return 0;
>  }
>  
>  static int ingenic_drm_suspend(struct device *dev)
> @@ -1611,7 +1609,7 @@ static struct platform_driver
> ingenic_drm_driver = {
>                 .of_match_table = of_match_ptr(ingenic_drm_of_match),
>         },
>         .probe = ingenic_drm_probe,
> -       .remove = ingenic_drm_remove,
> +       .remove_new = ingenic_drm_remove,
>  };
>  
>  static int ingenic_drm_init(void)
> diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c
> b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> index 7a43505011a5..fc0d8512d217 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c
> @@ -922,10 +922,9 @@ static int ingenic_ipu_probe(struct
> platform_device *pdev)
>         return component_add(&pdev->dev, &ingenic_ipu_ops);
>  }
>  
> -static int ingenic_ipu_remove(struct platform_device *pdev)
> +static void ingenic_ipu_remove(struct platform_device *pdev)
>  {
>         component_del(&pdev->dev, &ingenic_ipu_ops);
> -       return 0;
>  }
>  
>  static const u32 jz4725b_ipu_formats[] = {
> @@ -992,7 +991,7 @@ static struct platform_driver ingenic_ipu_driver
> = {
>                 .of_match_table = ingenic_ipu_of_match,
>         },
>         .probe = ingenic_ipu_probe,
> -       .remove = ingenic_ipu_remove,
> +       .remove_new = ingenic_ipu_remove,
>  };
>  
>  struct platform_driver *ingenic_ipu_driver_ptr =
> &ingenic_ipu_driver;



More information about the dri-devel mailing list