pinctrl: zte: fix group_desc initialization

Message ID 1495461575-29488-1-git-send-email-shawnguo@kernel.org
State New
Headers show

Commit Message

Shawn Guo May 22, 2017, 1:59 p.m.
From: Shawn Guo <shawn.guo@linaro.org>


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>

---
Hi Linus,

This is a fix for ZTE pinctrl driver that is queued on your devel branch.

Shawn

 drivers/pinctrl/zte/pinctrl-zx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Linus Walleij May 29, 2017, 8:17 a.m. | #1
On Mon, May 22, 2017 at 3:59 PM, Shawn Guo <shawnguo@kernel.org> wrote:

> From: Shawn Guo <shawn.guo@linaro.org>

>

> 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>


Patch applied.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/pinctrl/zte/pinctrl-zx.c b/drivers/pinctrl/zte/pinctrl-zx.c
index 2aca4e4b3f1c..787e3967bd5c 100644
--- a/drivers/pinctrl/zte/pinctrl-zx.c
+++ b/drivers/pinctrl/zte/pinctrl-zx.c
@@ -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);
 	}