Skip to content
Commit c8930ed0 authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Wolfram Sang
Browse files

i2c: Make return value check more accurate and explicit for devm_pinctrl_get()



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: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Acked-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Suggested-by: default avatarRussell King (Oracle) <linux@armlinux.org.uk>
Reviewed-by: default avatarAndi Shyti <andi.shyti@kernel.org>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent 4ba63869
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment