Skip to contentSkip to conversation

pinctrl: sirf: atlas7: Initialize GPIO offset

PATCH New Thierry Reding 2 participants 3 messages Jul 20, 2017 – Aug 2, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: sirf: atlas7: Initialize GPIO offset

From: Thierry Reding <[email protected]>

The GPIO offset is never initialized, which means that it will end up being zero as per the devm_kzalloc() of the parent structure.

---
I have no idea how the driver could've ever worked for anything other than instances with a single bank, but maybe it did and I missed some detail.

 drivers/pinctrl/sirf/pinctrl-atlas7.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pinctrl/sirf/pinctrl-atlas7.c +1 -0
index 36b5c8d5471e..a2ca4a9472c7 100644
@@ -6078,6 +6078,7 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
 		bank = &a7gc->banks[idx];
 		/* Set ctrl registers' base of this bank */
 		bank->base = ATLAS7_GPIO_BASE(a7gc, idx);
+		bank->gpio_offset = idx * NGPIO_OF_BANK;
 
 		/* Get interrupt number from DTS */
 		ret = of_irq_get(np, idx);
Signature · 1 line
2.13.3
#1 lore raw

PATCH 1/1 pinctrl: sirf: atlas7: Initialize GPIO offset

Quoted 5 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The GPIO offset is never initialized, which means that it will end up being zero as per the devm_kzalloc() of the parent structure.

Quoted 8 lines

---
I have no idea how the driver could've ever worked for anything other than instances with a single bank, but maybe it did and I missed some detail.

 drivers/pinctrl/sirf/pinctrl-atlas7.c | 1 +
 1 file changed, 1 insertion(+)

Any comments on this one?

Thierry

Quoted 16 lines
drivers/pinctrl/sirf/pinctrl-atlas7.c +1 -0
index 36b5c8d5471e..a2ca4a9472c7 100644
@@ -6078,6 +6078,7 @@ static int atlas7_gpio_probe(struct platform_device *pdev)
 		bank = &a7gc->banks[idx];
 		/* Set ctrl registers' base of this bank */
 		bank->base = ATLAS7_GPIO_BASE(a7gc, idx);
+		bank->gpio_offset = idx * NGPIO_OF_BANK;
 
 		/* Get interrupt number from DTS */
 		ret = of_irq_get(np, idx);
Signature · 1 line
2.13.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170731/e3b94dbb/attachment.sig>

#2 lore raw

PATCH 1/1 pinctrl: sirf: atlas7: Initialize GPIO offset

In reply to Thierry Reding
Quoted 10 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The GPIO offset is never initialized, which means that it will end up being zero as per the devm_kzalloc() of the parent structure.

---
I have no idea how the driver could've ever worked for anything other than instances with a single bank, but maybe it did and I missed some detail.

Patch applied.

I went in and attack-patched this driver, see:
commit 4e6fd26dcf5d70a7700a4c15d8f239103bdce91d "pinctrl: sirf/atlas7: stop poking around in GPIO internals"

I don't know if I may have upset the SirF developers or something, or if I was an especially big asshole for not noticing the problem I fixed already in the first iteration of the patch, or if I have done something else evil, but I just haven't heard from the developers since.

If the problem is me, I'm sorry :(

I would like to have this driver up-to-date and verified working.

Yours,
Linus Walleij