summaryrefslogtreecommitdiff
path: root/drivers/reset/core.c
diff options
context:
space:
mode:
authorJerome Brunet <jbrunet@baylibre.com>2017-02-15 21:15:51 +0300
committerPhilipp Zabel <p.zabel@pengutronix.de>2017-02-17 10:11:47 +0300
commite5a1dadec3648019a838b85357b67f241fbb02e8 (patch)
tree93610a81eede4f90e8232122010f1a4241be4368 /drivers/reset/core.c
parent7ce7d89f48834cefece7804d38fc5d85382edf77 (diff)
downloadlinux-e5a1dadec3648019a838b85357b67f241fbb02e8.tar.xz
reset: fix shared reset triggered_count decrement on error
For a shared reset, when the reset is successful, the triggered_count is incremented when trying to call the reset callback, so that another device sharing the same reset line won't trigger it again. If the reset has not been triggered successfully, the trigger_count should be decremented. The code does the opposite, and decrements the trigger_count on success. As a consequence, another device sharing the reset will be able to trigger it again. Fixed be removing negation in from of the error code of the reset function. Fixes: 7da33a37b48f ("reset: allow using reset_control_reset with shared reset") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset/core.c')
-rw-r--r--drivers/reset/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 10368ed8fd13..b6f5f1e1826c 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -163,7 +163,7 @@ int reset_control_reset(struct reset_control *rstc)
}
ret = rstc->rcdev->ops->reset(rstc->rcdev, rstc->id);
- if (rstc->shared && !ret)
+ if (rstc->shared && ret)
atomic_dec(&rstc->triggered_count);
return ret;