From: quentin.schulz@free-electrons.com (Quentin Schulz)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 8/9] pinctrl: axp209: add support for AXP813 GPIOs
Date: Fri, 8 Dec 2017 14:41:37 +0100 [thread overview]
Message-ID: <96bc20e3-97ca-ae76-9e35-e6af644659c7@free-electrons.com> (raw)
In-Reply-To: <20171205144647.17594-9-quentin.schulz@free-electrons.com>
Hi all,
There is a bug below.
On 05/12/2017 15:46, Quentin Schulz wrote:
> The AXP813 has only two GPIOs. GPIO0 can either be used as a GPIO, an
> LDO regulator or an ADC. GPIO1 can be used either as a GPIO or an LDO
> regulator.
>
> Moreover, the status bit of the GPIOs when in input mode is not offset
> by 4 unlike the AXP209.
>
> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> Acked-by: Rob Herring <robh@kernel.org>
[...]
> static int axp20x_pctl_probe(struct platform_device *pdev)
> {
> struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
> struct axp20x_pctl *pctl;
> + struct device *dev = &pdev->dev;
> struct pinctrl_desc *pctrl_desc;
> int ret;
>
> @@ -388,9 +413,9 @@ 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 = 3;
> + pctl->chip.ngpio = pctl->desc->npins;
>
> - pctl->desc = &axp20x_data;
> + pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
> pctl->regmap = axp20x->regmap;
> pctl->dev = &pdev->dev;
>
I am using pctl->desc before retrieving it, thus dereferencing from a
null pointer.
We just have to move
pctl->chip.ngpio = pctl->desc->npins;
after
pctl->desc = (struct axp20x_pctrl_desc *)of_device_get_match_data(dev);
Linus, I guess that I should send a patch to fix this or is there an
other way not to have to apply such a small and dumb patch?
Quentin
--
Quentin Schulz, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2017-12-08 13:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 14:46 [PATCH v5 00/11] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 1/9] gpio: axp209: switch unsigned variables to unsigned int Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 2/9] pinctrl: move gpio-axp209 to pinctrl Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 3/9] pinctrl: axp209: add pinctrl features Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 4/9] dt-bindings: gpio: gpio-axp209: " Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 5/9] pinctrl: axp209: rename everything from gpio to pctl Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 6/9] pinctrl: axp209: add programmable gpio_status_offset Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 7/9] pinctrl: axp209: add programmable ADC muxing value Quentin Schulz
2017-12-05 14:46 ` [PATCH v5 8/9] pinctrl: axp209: add support for AXP813 GPIOs Quentin Schulz
2017-12-08 13:41 ` Quentin Schulz [this message]
2017-12-13 7:36 ` Linus Walleij
2017-12-05 14:46 ` [PATCH v5 9/9] mfd: axp20x: add pinctrl cell for AXP813 Quentin Schulz
2017-12-07 9:34 ` Lee Jones
2017-12-05 14:51 ` [PATCH v5 00/11] add pinmuxing support for pins in AXP209 and AXP813 PMICs Quentin Schulz
2017-12-07 9:10 ` 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=96bc20e3-97ca-ae76-9e35-e6af644659c7@free-electrons.com \
--to=quentin.schulz@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.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