summaryrefslogtreecommitdiff
path: root/drivers/reset
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2019-11-20 15:59:26 +0100
committerPhilipp Zabel <p.zabel@pengutronix.de>2019-12-10 11:43:37 +0100
commitdb23808615e29d9a04f96806cac56f78b0fee0ef (patch)
tree1f281ab2c820c26fe28a1f50bb90ec7560052bd2 /drivers/reset
parent723c0011c7f6992f57e2c629fa9c89141acc115f (diff)
reset: Do not register resource data for missing resets
When an optional reset is not present, __devm_reset_control_get() and devm_reset_control_array_get() still register resource data to release the non-existing reset on cleanup, which is futile. Fix this by skipping NULL reset control pointers. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index c8cc8cacdade..7597c70e04d5 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -787,7 +787,7 @@ struct reset_control *__devm_reset_control_get(struct device *dev,
return ERR_PTR(-ENOMEM);
rstc = __reset_control_get(dev, id, index, shared, optional, acquired);
- if (!IS_ERR(rstc)) {
+ if (!IS_ERR_OR_NULL(rstc)) {
*ptr = rstc;
devres_add(dev, ptr);
} else {
@@ -928,7 +928,7 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
return ERR_PTR(-ENOMEM);
rstc = of_reset_control_array_get(dev->of_node, shared, optional, true);
- if (IS_ERR(rstc)) {
+ if (IS_ERR_OR_NULL(rstc)) {
devres_free(devres);
return rstc;
}