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

Wolfram Sang wsa at kernel.org
Fri Aug 25 14:07:15 PDT 2023


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 at huawei.com>
> Acked-by: Oleksij Rempel <o.rempel at pengutronix.de>
> Reviewed-by: Linus Walleij <linus.walleij at linaro.org>
> Acked-by: Nicolas Ferre <nicolas.ferre at microchip.com>
> Suggested-by: Russell King (Oracle) <linux at armlinux.org.uk>

Applied to for-next, thanks!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20230825/5c3996a6/attachment.sig>


More information about the linux-arm-kernel mailing list