summaryrefslogtreecommitdiff
path: root/drivers/power
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@microchip.com>2018-08-30 14:50:11 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-20 18:00:01 +0100
commit3a9539e9ba18703b21b9aa398673179e9c5eabe5 (patch)
tree3e3aa9dedbe17b5aa1f9d640cef7aab79e607bbd /drivers/power
parente0ecbca8ff27376cbaa68e5c64374344b85c760c (diff)
power: reset: at91-poweroff: do not procede if at91_shdwc is allocated
[ Upstream commit 9f1e44774be578fb92776add95f1fcaf8284d692 ] There should be only one instance of struct shdwc in the system. This is referenced through at91_shdwc. Return in probe if at91_shdwc is already allocated. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/reset/at91-sama5d2_shdwc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
index 31080c254124..037976a1fe40 100644
--- a/drivers/power/reset/at91-sama5d2_shdwc.c
+++ b/drivers/power/reset/at91-sama5d2_shdwc.c
@@ -246,6 +246,9 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
if (!pdev->dev.of_node)
return -ENODEV;
+ if (at91_shdwc)
+ return -EBUSY;
+
at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL);
if (!at91_shdwc)
return -ENOMEM;