From: Mylene JOSSERAND <mylene.josserand@free-electrons.com>
To: Quentin Schulz <quentin.schulz@free-electrons.com>
Cc: linus.walleij@linaro.org, wens@csie.org,
maxime.ripard@free-electrons.com, linux-gpio@vger.kernel.org,
linux-kernel@vger.kernel.org,
thomas.petazzoni@free-electrons.com,
linux-sunxi@googlegroups.com
Subject: Re: [PATCH] pinctrl: axp209: dereference pointer after it's been set
Date: Wed, 13 Dec 2017 10:20:48 +0100 [thread overview]
Message-ID: <20171213102048.1c7e3b7f@dell-desktop.home> (raw)
In-Reply-To: <20171213085503.31899-1-quentin.schulz@free-electrons.com>
Hello Quentin,
Le Wed, 13 Dec 2017 09:55:03 +0100,
Quentin Schulz <quentin.schulz@free-electrons.com> a écrit :
> The number of GPIOs is gotten from a field within the structure
> referenced in the of_device.data but it was actually read before it was
> retrieved, thus it was dereferencing a null pointer.
>
> Set the number of GPIOs after retrieving of_device.data.
>
> Fixes: e1190083b89b ("pinctrl: axp209: add support for AXP813 GPIOs")
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> Reported-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Tested-by: Mylène Josserand <mylene.josserand@free-electrons.com>
Thanks,
Mylène
> ---
> drivers/pinctrl/pinctrl-axp209.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/pinctrl-axp209.c b/drivers/pinctrl/pinctrl-axp209.c
> index 22d3bb0bf927..510a2821e910 100644
> --- a/drivers/pinctrl/pinctrl-axp209.c
> +++ b/drivers/pinctrl/pinctrl-axp209.c
> @@ -413,9 +413,11 @@ static int axp20x_pctl_probe(struct platform_device *pdev)
> pctl->chip.set = axp20x_gpio_set;
> pctl->chip.direction_input = axp20x_gpio_input;
> pctl->chip.direction_output = axp20x_gpio_output;
> - pctl->chip.ngpio = pctl->desc->npins;
>
> pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
> +
> + pctl->chip.ngpio = pctl->desc->npins;
> +
> pctl->regmap = axp20x->regmap;
> pctl->dev = &pdev->dev;
>
--
Mylène Josserand, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2017-12-13 9:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-13 8:55 Quentin Schulz
2017-12-13 9:20 ` Mylene JOSSERAND [this message]
2017-12-14 3:05 ` Chen-Yu Tsai
2017-12-20 8:07 ` Linus Walleij
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=20171213102048.1c7e3b7f@dell-desktop.home \
--to=mylene.josserand@free-electrons.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=maxime.ripard@free-electrons.com \
--cc=quentin.schulz@free-electrons.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=wens@csie.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
all inboxes | Powered by JetHome®