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 <[email protected]>
Acked-by: Nicolas Ferre <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
Claudiu Beznea 2018-08-30 14:50:11 +03:00 • committed by Sebastian Reichel
commit 9f1e44774b

View file

@ -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;