summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@microchip.com>2018-08-30 14:50:11 +0300
committerSebastian Reichel <sre@kernel.org>2018-09-16 12:32:17 +0200
commit9f1e44774be578fb92776add95f1fcaf8284d692 (patch)
tree33611b7c2e2da13f9493689fc0b9d97d561fe0f5
parentd12f84906bcb9384d0bf58726688fb60aac8a100 (diff)
downloadlinux-stable-9f1e44774be578fb92776add95f1fcaf8284d692.tar.gz
linux-stable-9f1e44774be578fb92776add95f1fcaf8284d692.tar.bz2
linux-stable-9f1e44774be578fb92776add95f1fcaf8284d692.zip
power: reset: at91-poweroff: do not procede if at91_shdwc is allocated
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>
-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 ad6e2796690a..2b686c55b717 100644
--- a/drivers/power/reset/at91-sama5d2_shdwc.c
+++ b/drivers/power/reset/at91-sama5d2_shdwc.c
@@ -255,6 +255,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;