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().
Unified · Split
| @@ -1378,9 +1378,20 @@ static int pca953x_restore_context(struct pca953x_chip *chip) · 1377 unmodified lines | |||
| 1378 | regcache_mark_dirty(chip->regmap); | 1378 | regcache_mark_dirty(chip->regmap); |
| 1379 | ret = pca953x_regcache_sync(chip); | 1379 | ret = pca953x_regcache_sync(chip); |
| 1380 | if (ret) | 1380 | 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; | ||
| 1382 | 1388 | ||
| 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; | ||
| 1384 | } | 1395 | } |
| 1385 | 1396 | ||
| 1386 | static void pca953x_save_context(struct pca953x_chip *chip) | 1397 | static void pca953x_save_context(struct pca953x_chip *chip) |