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-25 11:52:21 +0300
commitc8dc500fac020debfc198aab0ace2d6a5b7ed236 (patch)
tree00398e066eb55a335235833d2589db48dea594a6 /drivers/power
parentc83c60771e3bf2445fad590a97111ff418831527 (diff)
downloadlinux-c8dc500fac020debfc198aab0ace2d6a5b7ed236.tar.xz
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 90b0b5a70ce5..04ca990e8f6c 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;