Skip to content

Commit 15fbb1f

Browse files
rjarzmikgregkh
authored andcommitted
gpio: pxa: handle corner case of unprobed device
[ Upstream commit 9ce3ebe ] In the corner case where the gpio driver probe fails, for whatever reason, the suspend and resume handlers will still be called as they have to be registered as syscore operations. This applies as well when no probe was called while the driver has been built in the kernel. Nicolas tracked this in : https://bugzilla.kernel.org/show_bug.cgi?id=200905 Therefore, add a failsafe in these function, and test if a proper probe succeeded and the driver is functional. Signed-off-by: Robert Jarzmik <[email protected]> Reported-by: Nicolas Chauvet <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6fee657 commit 15fbb1f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/gpio/gpio-pxa.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,9 @@ static int pxa_gpio_suspend(void)
776776
struct pxa_gpio_bank *c;
777777
int gpio;
778778

779+
if (!pchip)
780+
return 0;
781+
779782
for_each_gpio_bank(gpio, c, pchip) {
780783
c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
781784
c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
@@ -794,6 +797,9 @@ static void pxa_gpio_resume(void)
794797
struct pxa_gpio_bank *c;
795798
int gpio;
796799

800+
if (!pchip)
801+
return;
802+
797803
for_each_gpio_bank(gpio, c, pchip) {
798804
/* restore level with set/clear */
799805
writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET);

0 commit comments

Comments
 (0)