Re: [PATCH -next v2] I2C: Fix return value check for devm_pinctrl_get()

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

 



Hi,

Le 17/08/2023 à 19:30, Leo Li a écrit :

The devm_pinctrl_get() function returns error pointers and never returns
NULL. Update the checks accordingly.
Not exactly.  It can return NULL when CONFIG_PINCTRL is not defined.  We probably should fix that API too.

include/linux/pinctrl/consumer.h:
static inline struct pinctrl * __must_check devm_pinctrl_get(struct device *dev)
{
         return NULL;
}

So, as Leo pointed out it seems devm_pinctrl_get() can in fact return NULL, when CONFIG_PINCTRL is not defined.

What do we do about this?

Proposals:

1/ make sure all call sites of devm_pinctrl_get() do check for error with IS_ERR *and* check for NULL => therefore using IS_ERR_OR_NULL

2/ change the fallback implementation in include/linux/pinctrl/consumer.h to return ERR_PTR(-Esomething) (which errno?)

3/ another solution?

Regards,

--

Yann




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux