pinctrl: axp209: dereference pointer after it's been set
authorQuentin Schulz <quentin.schulz@free-electrons.com>
Wed, 13 Dec 2017 08:55:03 +0000 (09:55 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 20 Dec 2017 08:06:29 +0000 (09:06 +0100)
commita049815229b6fcf0dd927630cbf5c127f5fb2a82
tree1cad5808446c50beb50e4fc2813f4d44d71c7368
parent5c9d8c4f6b8168738a26bcf288516cc3a0886810
pinctrl: axp209: dereference pointer after it's been set

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>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/pinctrl-axp209.c