]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
gpio: pca953x: fix cache_only and IRQ state on restore_context() failure
authorbui duc phuc <phucduc.bui@gmail.com>
Mon, 27 Jul 2026 08:02:05 +0000 (15:02 +0700)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 27 Jul 2026 12:58:26 +0000 (14:58 +0200)
When pca953x_restore_context() fails, cache_only is left disabled and
the IRQ left enabled, even though register synchronization may not have
completed successfully. Restore cache_only and disable the IRQ again on
failure, matching the state set by pca953x_save_context().

Fixes: ec5bde62019b ("gpio: pca953x: Split pca953x_restore_context() and pca953x_save_context()")
Fixes: 3e38f946062b ("gpio: pca953x: fix IRQ storm on system wake up")
Cc: stable@vger.kernel.org
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Link: https://patch.msgid.link/20260727080205.16353-1-phucduc.bui@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpio-pca953x.c

index e03bf1b12091001850a2f653cc9b0c979a7315d7..aac9ea7520b60b58e7e99ddaf737b496876f9b97 100644 (file)
@@ -1378,9 +1378,20 @@ static int pca953x_restore_context(struct pca953x_chip *chip)
        regcache_mark_dirty(chip->regmap);
        ret = pca953x_regcache_sync(chip);
        if (ret)
-               return ret;
+               goto err;
+
+       ret = regcache_sync(chip->regmap);
+       if (ret)
+               goto err;
+
+       return 0;
 
-       return regcache_sync(chip->regmap);
+err:
+       if (chip->client->irq > 0)
+               disable_irq(chip->client->irq);
+       regcache_cache_only(chip->regmap, true);
+
+       return ret;
 }
 
 static void pca953x_save_context(struct pca953x_chip *chip)