Re: [PATCH 04/52] input: iqs62x-keys - Convert to platform remove callback returning void

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 20, 2023 at 02:57:41PM +0200, Uwe Kleine-König wrote:
> 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 ignored (apart
> from emitting a warning) 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. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> 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@xxxxxxxxxxxxxx>

Reviewed-by: Jeff LaBundy <jeff@xxxxxxxxxxx>

> ---
>  drivers/input/keyboard/iqs62x-keys.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/input/keyboard/iqs62x-keys.c b/drivers/input/keyboard/iqs62x-keys.c
> index 02ceebad7bda..688d61244b5f 100644
> --- a/drivers/input/keyboard/iqs62x-keys.c
> +++ b/drivers/input/keyboard/iqs62x-keys.c
> @@ -310,7 +310,7 @@ static int iqs62x_keys_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int iqs62x_keys_remove(struct platform_device *pdev)
> +static void iqs62x_keys_remove(struct platform_device *pdev)
>  {
>  	struct iqs62x_keys_private *iqs62x_keys = platform_get_drvdata(pdev);
>  	int ret;
> @@ -319,8 +319,6 @@ static int iqs62x_keys_remove(struct platform_device *pdev)
>  						 &iqs62x_keys->notifier);
>  	if (ret)
>  		dev_err(&pdev->dev, "Failed to unregister notifier: %d\n", ret);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver iqs62x_keys_platform_driver = {
> @@ -328,7 +326,7 @@ static struct platform_driver iqs62x_keys_platform_driver = {
>  		.name = "iqs62x-keys",
>  	},
>  	.probe = iqs62x_keys_probe,
> -	.remove = iqs62x_keys_remove,
> +	.remove_new = iqs62x_keys_remove,
>  };
>  module_platform_driver(iqs62x_keys_platform_driver);
>  
> -- 
> 2.40.1
> 



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux