Skip to contentSkip to conversation

watchdog: Handle multiple wm831x watchdogs being registered

PATCH New Mark Brown 1 participant 1 message May 31, 2011

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 watchdog: Handle multiple wm831x watchdogs being registered

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.

---
 drivers/watchdog/wm831x_wdt.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/watchdog/wm831x_wdt.c +5 -0
index 8c4b2d5..871caea 100644
@@ -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);
Signature · 1 line
1.7.5.1