aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinmux.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-01-20 10:43:53 -0500
committerLinus Walleij <linus.walleij@linaro.org>2012-01-26 08:13:05 -0500
commit9e2551e10b5c7ba550849bd9ed519e498cc30e68 (patch)
treee84e7f61908463ac052faffeca40796d77e5030f /drivers/pinctrl/pinmux.c
parentde849eecd0addaa6bf60f2f7be36b30abf9ff2ae (diff)
pinctrl: fix pinmux_hog_maps when ctrl_dev_name is not set
The ctrl_dev_name is optional for struct pinmux_map assuming that ctrl_dev is set. Without this patch we can get: Unable to handle kernel NULL pointer dereference at virtual address 00000000 ... (pinmux_hog_maps+0xa4/0x20c) (pinctrl_register+0x2a4/0x378) ... Fix this by adding adding a test for map->ctrl_dev. Additionally move the test for map->ctrl_dev earlier to optimize out the loop a bit. Signed-off-by: Tony Lindgren <tony@atomide.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r--drivers/pinctrl/pinmux.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index f4f8c7e4b1c8..3ffa9324ed82 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -978,9 +978,12 @@ int pinmux_hog_maps(struct pinctrl_dev *pctldev)
978 for (i = 0; i < pinmux_maps_num; i++) { 978 for (i = 0; i < pinmux_maps_num; i++) {
979 struct pinmux_map const *map = &pinmux_maps[i]; 979 struct pinmux_map const *map = &pinmux_maps[i];
980 980
981 if (((map->ctrl_dev == dev) || 981 if (!map->hog_on_boot)
982 !strcmp(map->ctrl_dev_name, devname)) && 982 continue;
983 map->hog_on_boot) { 983
984 if ((map->ctrl_dev == dev) ||
985 (map->ctrl_dev_name &&
986 !strcmp(map->ctrl_dev_name, devname))) {
984 /* OK time to hog! */ 987 /* OK time to hog! */
985 ret = pinmux_hog_map(pctldev, map); 988 ret = pinmux_hog_map(pctldev, map);
986 if (ret) 989 if (ret)