From: Stefan Agner <stefan@agner.ch>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-gpio@vger.kernel.org,
"Dong Aisheng" <dong.aisheng@linaro.org>,
"Sascha Hauer" <kernel@pengutronix.de>,
linux-arm-kernel@lists.infradead.org,
"Shawn Guo" <shawn.guo@linaro.org>
Subject: Re: [PATCH] pinctrl: pinctrl-imx: don't use invalid value of conf_reg
Date: Fri, 06 Feb 2015 15:23:50 +0100 [thread overview]
Message-ID: <8c67105fcfe76ae1dd86e8c65954275d@agner.ch> (raw)
In-Reply-To: <CACRpkdYXW5X7bSiRPTC3uHT=s+hjxj+jS0YJCBWrcmzHWkpqHg@mail.gmail.com>
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@pengutronix.de> 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@pengutronix.de> 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@pengutronix.de>
>>>
>>> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2015-02-06 14:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-27 22:50 [PATCH] pinctrl: pinctrl-imx: don't use invalid value of conf_reg Uwe Kleine-König
2015-01-27 23:15 ` Uwe Kleine-König
2015-02-03 13:01 ` Linus Walleij
2015-02-03 19:01 ` Uwe Kleine-König
2015-02-05 13:53 ` Linus Walleij
2015-02-06 14:23 ` Stefan Agner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8c67105fcfe76ae1dd86e8c65954275d@agner.ch \
--to=stefan@agner.ch \
--cc=dong.aisheng@linaro.org \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=shawn.guo@linaro.org \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).