Skip to content

Commit

Permalink
watchdog: Handle multiple wm831x watchdogs being registered
Browse files Browse the repository at this point in the history
Due to the whole single instance based watchdog API we use static data
for the wm831x watchdog which means that if the system tries to register
a second one we end up trying to register the same miscdevice again,
corrupting the miscdevice list. Work around this by checking for duplicate
registrations until we get a watchdog core.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Mark Brown authored and Wim Van Sebroeck committed Jun 28, 2011
1 parent b0af8df commit 076bad7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/watchdog/wm831x_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ static int __devinit wm831x_wdt_probe(struct platform_device *pdev)
struct wm831x_watchdog_pdata *pdata;
int reg, ret;

if (wm831x) {
dev_err(&pdev->dev, "wm831x watchdog already registered\n");
return -EBUSY;
}

wm831x = dev_get_drvdata(pdev->dev.parent);

ret = wm831x_reg_read(wm831x, WM831X_WATCHDOG);
Expand Down

0 comments on commit 076bad7

Please sign in to comment.