History

gpio: pca953x: fix cache_only and IRQ state on restore_context() failure

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().

bui duc phuc committed 3 months ago

Commit d2330871 parent 67ff4bf1 file · +13 −2Browse files

Unified · Split

drivers/gpio/gpio-pca953x.c+13−2
@@ -1378,9 +1378,20 @@ static int pca953x_restore_context(struct pca953x_chip *chip) · 1377 unmodified lines
13781378 regcache_mark_dirty(chip->regmap);
13791379 ret = pca953x_regcache_sync(chip);
13801380 if (ret)
1381− return ret;
1381+ goto err;
1382+
1383+ ret = regcache_sync(chip->regmap);
1384+ if (ret)
1385+ goto err;
1386+
1387+ return 0;
13821388
1383− return regcache_sync(chip->regmap);
1389+err:
1390+ if (chip->client->irq > 0)
1391+ disable_irq(chip->client->irq);
1392+ regcache_cache_only(chip->regmap, true);
1393+
1394+ return ret;
13841395 }
13851396
13861397 static void pca953x_save_context(struct pca953x_chip *chip)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t