summaryrefslogtreecommitdiff
path: root/drivers/memory/tegra
diff options
context:
space:
mode:
authorCai Huoqing <caihuoqing@baidu.com>2021-09-22 21:00:01 +0800
committerKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>2021-09-24 13:18:47 +0200
commit1d8e0223bb52071ffc59391f0ebefa06ce5643d7 (patch)
tree329c21a84e482a3021e3c73ab3a6d8b4fe80ded0 /drivers/memory/tegra
parent13324edbe9269e6fbca4d0f5146b18ef8478c958 (diff)
memory: tegra: Make use of the helper function devm_add_action_or_reset()
Use devm_add_action_or_reset() instead of devm_add_action() to simplify the error handling. Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Link: https://lore.kernel.org/r/20210922130002.586-1-caihuoqing@baidu.com Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Diffstat (limited to 'drivers/memory/tegra')
-rw-r--r--drivers/memory/tegra/mc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/memory/tegra/mc.c b/drivers/memory/tegra/mc.c
index 6b710c204799..44b4a4080920 100644
--- a/drivers/memory/tegra/mc.c
+++ b/drivers/memory/tegra/mc.c
@@ -87,11 +87,9 @@ struct tegra_mc *devm_tegra_memory_controller_get(struct device *dev)
return ERR_PTR(-EPROBE_DEFER);
}
- err = devm_add_action(dev, tegra_mc_devm_action_put_device, mc);
- if (err) {
- put_device(mc->dev);
+ err = devm_add_action_or_reset(dev, tegra_mc_devm_action_put_device, mc);
+ if (err)
return ERR_PTR(err);
- }
return mc;
}