Skip to content

Commit 14bfaa1

Browse files
committed
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>
1 parent a2c6ece commit 14bfaa1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/power/reset/at91-sama5d2_shdwc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,9 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
255255
if (!pdev->dev.of_node)
256256
return -ENODEV;
257257

258+
if (at91_shdwc)
259+
return -EBUSY;
260+
258261
at91_shdwc = devm_kzalloc(&pdev->dev, sizeof(*at91_shdwc), GFP_KERNEL);
259262
if (!at91_shdwc)
260263
return -ENOMEM;

0 commit comments

Comments
 (0)