[PATCH 16/89] i2c: davinci: Improve error reporting for problems during .remove()

Bartosz Golaszewski brgl at bgdev.pl
Thu May 11 02:02:29 PDT 2023


On Mon, May 8, 2023 at 10:53 PM Uwe Kleine-König
<u.kleine-koenig at pengutronix.de> wrote:
>
> If pm_runtime_get() fails in .remove() the driver used to return the
> error to the driver core. The only effect of this (compared to returning
> zero) is a generic warning that the error value is ignored. (The device
> is unbound then anyhow.)
>
> Emit a better warning and return zero to suppress the generic (and
> little helpful) message. Also disable runtime PM in the error case.
>
> This prepares changing platform device remove callbacks to return void.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
>  drivers/i2c/busses/i2c-davinci.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index 9750310f2c96..7ba7e6cbcc97 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -894,11 +894,11 @@ static int davinci_i2c_remove(struct platform_device *pdev)
>
>         i2c_del_adapter(&dev->adapter);
>
> -       ret = pm_runtime_resume_and_get(&pdev->dev);
> +       ret = pm_runtime_get_sync(&pdev->dev);
>         if (ret < 0)
> -               return ret;
> -
> -       davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
> +               dev_err(&pdev->dev, "Failed to resume device\n");
> +       else
> +               davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
>
>         pm_runtime_dont_use_autosuspend(dev->dev);
>         pm_runtime_put_sync(dev->dev);
> --
> 2.39.2
>

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski at linaro.org>



More information about the linux-arm-kernel mailing list