Re: [PATCH -next v3] I2C: Make return value check more accurate and explicit for devm_pinctrl_get()

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

 



Hi,

On Thu, Aug 24, 2023 at 10:34:53AM +0200, Oleksij Rempel wrote:
> On Mon, Aug 21, 2023 at 11:29:14AM +0800, Jinjie Ruan wrote:
> > If pinctrl is not available (thus devm_pinctrl_get() returns NULL) then
> > recovery can't work, because we can't switch the I2C pins between the
> > I2C controller and GPIO. So, it is quite correct to print
> > "can't get pinctrl, bus recovery not supported" because the I2C bus
> > can't be recovered without pinctrl.
> > 
> > The PTR_ERR() is also fine - because if pinctrl is not present and
> > returns NULL, we'll end up returning zero, which is exactly what we
> > want.
> > 
> > However, open code that with a more accurate message will be more explicit
> > for NULL case when CONFIG_PINCTRL is not defined.
> > 
> > Signed-off-by: Jinjie Ruan <ruanjinjie@xxxxxxxxxx>
> > Acked-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> > Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
> > Acked-by: Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>
> > Suggested-by: Russell King (Oracle) <linux@xxxxxxxxxxxxxxx>
> > ---
> > v3:
> > - Split into two if() statements instead of removing the NULL checks.
> > - Remove the fix tags.
> > - Update the commit title and message.
> > - Update to bring the author's name before.
> > v2:
> > - Remove NULL check instead of using IS_ERR_OR_NULL() to avoid leaving them behind.
> > - Update the commit title and message.
> > ---
> >  drivers/i2c/busses/i2c-at91-master.c | 6 +++++-
> >  drivers/i2c/busses/i2c-imx.c         | 6 +++++-
> >  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> Acked-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> 
> for the i2c-imx.c

For some reason lore+lei failed to deliver this message to my
inbox :/

Anyway, looks good!

Reviewed-by: Andi Shyti <andi.shyti@xxxxxxxxxx> 

Thank you, Jinjie for following up.
Andi



[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