Re: [PATCH] pinctrl: pinctrl-imx: don't use invalid value of conf_reg

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

 



On 2015-02-05 14:53, Linus Walleij wrote:
> On Tue, Feb 3, 2015 at 8:01 PM, Uwe Kleine-König
> <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>> On Tue, Feb 03, 2015 at 02:01:09PM +0100, Linus Walleij wrote:
>>> On Tue, Jan 27, 2015 at 11:50 PM, Uwe Kleine-König
>>> <u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
>>>
>>> > The right check for conf_reg to be invalid it testing against -1 not 0
>>> > as is done in the rest of the driver.
>>> >
>>> > This fixes an oops that can be triggered by:
>>> >
>>> >         cat /sys/kernel/debug/pinctrl/43fac000.iomuxc/*
>>> >
>>> > Fixes: ae75ff814538 ("pinctrl: pinctrl-imx: add imx pinctrl core driver")

This was actually introduce by me in 3dac1918a491 ("pinctrl: imx: detect
uninitialized pins").

>>> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
>>>
>>> Patch applied.
>>>
>>> But...
>>>
>>> > -       if (!pin_reg || !pin_reg->conf_reg) {
>>> > +       if (!pin_reg || pin_reg->conf_reg == -1) {
>>>
>>> I can see that the other code checks for -1 in this variable.
>>> But where is conf_reg ever set to -1?
>>>
>>> freescale]$ git grep "\-1"
>>> pinctrl-imx.c:          if (pin_reg->mux_reg == -1) {
>>> pinctrl-imx.c:  if (pin_reg->mux_reg == -1)
>>> pinctrl-imx.c:  if (pin_reg->mux_reg == -1)
>>> pinctrl-imx.c:  if (pin_reg->conf_reg == -1) {
>>> pinctrl-imx.c:  if (pin_reg->conf_reg == -1) {
>>> pinctrl-imx.c:  if (!pin_reg || pin_reg->conf_reg == -1) {
>> Uah, ugly. This member gets -1 by means of:
>>
>>         memset(info->pin_regs, 0xff, sizeof(*info->pin_regs) * info->npins);
> 
> OMG. Uwe can you make a patch changing that initialization
> code to something sane? We can't have it like this.

Oh sorry, this was actually me, in the commit mentioned above. That's
ugly, I agree. I'm wondering how I came to that idea....

Will send a patch for that.

--
Stefan
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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