Re: [PATCH 72/89] i2c: synquacer: Convert to platform remove callback returning void

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

 



On Mon, 8 May 2023 at 22:53, Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> 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>

Acked-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

> ---
>  drivers/i2c/busses/i2c-synquacer.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
> index 50d19cf99a03..4cc196ca8f6d 100644
> --- a/drivers/i2c/busses/i2c-synquacer.c
> +++ b/drivers/i2c/busses/i2c-synquacer.c
> @@ -618,15 +618,13 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
>         return 0;
>  }
>
> -static int synquacer_i2c_remove(struct platform_device *pdev)
> +static void synquacer_i2c_remove(struct platform_device *pdev)
>  {
>         struct synquacer_i2c *i2c = platform_get_drvdata(pdev);
>
>         i2c_del_adapter(&i2c->adapter);
>         if (!IS_ERR(i2c->pclk))
>                 clk_disable_unprepare(i2c->pclk);
> -
> -       return 0;
>  };
>
>  static const struct of_device_id synquacer_i2c_dt_ids[] __maybe_unused = {
> @@ -645,7 +643,7 @@ MODULE_DEVICE_TABLE(acpi, synquacer_i2c_acpi_ids);
>
>  static struct platform_driver synquacer_i2c_driver = {
>         .probe  = synquacer_i2c_probe,
> -       .remove = synquacer_i2c_remove,
> +       .remove_new = synquacer_i2c_remove,
>         .driver = {
>                 .name = "synquacer_i2c",
>                 .of_match_table = of_match_ptr(synquacer_i2c_dt_ids),
> --
> 2.39.2
>




[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