linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Dong Aisheng <dong.aisheng@linaro.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Shawn Guo <shawn.guo@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] pinctrl: pinctrl-imx: don't use invalid value of conf_reg
Date: Tue, 3 Feb 2015 20:01:41 +0100	[thread overview]
Message-ID: <20150203190141.GE10842@pengutronix.de> (raw)
In-Reply-To: <CACRpkdbtpGU57-tPn9Z0rNvY4zLk+QE6A9Pd87vLUHOmRiB2yg@mail.gmail.com>

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")
> > 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);

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
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

  reply	other threads:[~2015-02-03 19:01 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 [this message]
2015-02-05 13:53     ` Linus Walleij
2015-02-06 14:23       ` Stefan Agner

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=20150203190141.GE10842@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --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 \
    /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).