Re: [PATCH 13/89] i2c: cht-wc: Convert to platform remove callback returning void

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

 



Hi,

On 5/8/23 22:51, 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 (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@xxxxxxxxxxxxxx>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@xxxxxxxxxx>

Regards,

Hans


> ---
>  drivers/i2c/busses/i2c-cht-wc.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cht-wc.c b/drivers/i2c/busses/i2c-cht-wc.c
> index 2b2c3d090089..0209933b9a84 100644
> --- a/drivers/i2c/busses/i2c-cht-wc.c
> +++ b/drivers/i2c/busses/i2c-cht-wc.c
> @@ -529,15 +529,13 @@ static int cht_wc_i2c_adap_i2c_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
> +static void cht_wc_i2c_adap_i2c_remove(struct platform_device *pdev)
>  {
>  	struct cht_wc_i2c_adap *adap = platform_get_drvdata(pdev);
>  
>  	i2c_unregister_device(adap->client);
>  	i2c_del_adapter(&adap->adapter);
>  	irq_domain_remove(adap->irq_domain);
> -
> -	return 0;
>  }
>  
>  static const struct platform_device_id cht_wc_i2c_adap_id_table[] = {
> @@ -548,7 +546,7 @@ MODULE_DEVICE_TABLE(platform, cht_wc_i2c_adap_id_table);
>  
>  static struct platform_driver cht_wc_i2c_adap_driver = {
>  	.probe = cht_wc_i2c_adap_i2c_probe,
> -	.remove = cht_wc_i2c_adap_i2c_remove,
> +	.remove_new = cht_wc_i2c_adap_i2c_remove,
>  	.driver = {
>  		.name = "cht_wcove_ext_chgr",
>  	},




[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux