summaryrefslogtreecommitdiff
path: root/drivers/watchdog/watchdog_core.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2019-05-18 23:27:17 +0200
committerWim Van Sebroeck <wim@linux-watchdog.org>2019-07-08 15:13:01 +0200
commitb608075e4bd6ad21968e8bfddd396c43b625e2b1 (patch)
treeb55e81aff52f0ee44d1cf0f5a96b62a77c77a70f /drivers/watchdog/watchdog_core.c
parent80030425e0207172cd68a8952c5054db85ffa85f (diff)
watchdog: let core print error message when registering device fails
So we can remove boilerplate code from drivers. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/watchdog_core.c')
-rw-r--r--drivers/watchdog/watchdog_core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 9fd096af0cc5..cf3247224a6e 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -264,6 +264,7 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
int watchdog_register_device(struct watchdog_device *wdd)
{
+ const char *dev_str;
int ret = 0;
mutex_lock(&wtd_deferred_reg_mutex);
@@ -272,6 +273,14 @@ int watchdog_register_device(struct watchdog_device *wdd)
else
watchdog_deferred_registration_add(wdd);
mutex_unlock(&wtd_deferred_reg_mutex);
+
+ if (ret) {
+ dev_str = wdd->parent ? dev_name(wdd->parent) :
+ (const char *)wdd->info->identity;
+ pr_err("%s: failed to register watchdog device (err = %d)\n",
+ dev_str, ret);
+ }
+
return ret;
}
EXPORT_SYMBOL_GPL(watchdog_register_device);