Re: [PATCH] iio: sca3000: Remove an erroneous 'get_device()'

From: Andy Shevchenko
Date: Wed May 06 2020 - 06:38:31 EST


On Wed, May 6, 2020 at 6:55 AM Christophe JAILLET
<christophe.jaillet@xxxxxxxxxx> wrote:
>
> This looks really unusual to have a 'get_device()' hidden in a 'dev_err()'
> call.
> Remove it.
>
> While at it add a missing \n at the end of the message.
>

It should have Fixes tag because it is a quite an issue (get_device()
breaks reference counting with all problems we may expect).

> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> ---
> This patch is purely speculative.
> I've looked a bit arround and see no point for this get_device() but other
> eyes are welcomed :)
> ---
> drivers/iio/accel/sca3000.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
> index 66d768d971e1..6e429072e44a 100644
> --- a/drivers/iio/accel/sca3000.c
> +++ b/drivers/iio/accel/sca3000.c
> @@ -980,7 +980,7 @@ static int sca3000_read_data(struct sca3000_state *st,
> st->tx[0] = SCA3000_READ_REG(reg_address_high);
> ret = spi_sync_transfer(st->us, xfer, ARRAY_SIZE(xfer));
> if (ret) {
> - dev_err(get_device(&st->us->dev), "problem reading register");
> + dev_err(&st->us->dev, "problem reading register\n");
> return ret;
> }
>
> --
> 2.25.1
>


--
With Best Regards,
Andy Shevchenko