pinctrl: zte: fix group_desc initialization
authorShawn Guo <shawn.guo@linaro.org>
Mon, 22 May 2017 13:59:35 +0000 (21:59 +0800)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 29 May 2017 08:16:16 +0000 (10:16 +0200)
There are a couple of issues with group_desc initialization in function
zx_pinctrl_build_state().

 - num_pins is not initialized and remains zero.
 - pins shouldn't be initialized with a pointer to variable in the
   stack.

With them fixed, pin_request() in pinmux_enable_setting() can be invoked
correctly.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/zte/pinctrl-zx.c

index 2aca4e4b3f1c093a8ab46bcbc15509311d2e6a91..787e3967bd5c5741aeb7a2cb96c18e38901092ed 100644 (file)
@@ -282,10 +282,10 @@ static int zx_pinctrl_build_state(struct platform_device *pdev)
        for (i = 0; i < ngroups; i++) {
                const struct pinctrl_pin_desc *pindesc = info->pins + i;
                struct group_desc *group = groups + i;
-               int id = pindesc->number;
 
                group->name = pindesc->name;
-               group->pins = &id;
+               group->pins = (int *) &pindesc->number;
+               group->num_pins = 1;
                radix_tree_insert(&pctldev->pin_group_tree, i, group);
        }