From: Claudiu Beznea Date: Thu, 30 Aug 2018 11:50:11 +0000 (+0300) Subject: power: reset: at91-poweroff: do not procede if at91_shdwc is allocated X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9f1e44774be578fb92776add95f1fcaf8284d692;p=linux.git 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 Acked-by: Nicolas Ferre Signed-off-by: Sebastian Reichel --- diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c index ad6e2796690a3..2b686c55b7175 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;