[PATCH 4/5] watchdog: mena21: Do not use device pointer from struct watchdog_device

From: Guenter Roeck
Date: Thu Dec 24 2015 - 00:11:58 EST


The device pointer in struct watchdog_device has a different lifetime
than the driver code and should not be used in drivers. Use pr_err
instead of dev_err.

Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
---
drivers/watchdog/mena21_wdt.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/mena21_wdt.c b/drivers/watchdog/mena21_wdt.c
index 098fa9c34d6d..f0dc794d0fda 100644
--- a/drivers/watchdog/mena21_wdt.c
+++ b/drivers/watchdog/mena21_wdt.c
@@ -7,6 +7,9 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*/
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@ -100,13 +103,14 @@ static int a21_wdt_set_timeout(struct watchdog_device *wdt,
struct a21_wdt_drv *drv = watchdog_get_drvdata(wdt);

if (timeout != 1 && timeout != 30) {
- dev_err(wdt->dev, "Only 1 and 30 allowed as timeout\n");
+ pr_err("watchdog%d: Only 1 and 30 allowed as timeout\n",
+ wdt->id);
return -EINVAL;
}

if (timeout == 30 && wdt->timeout == 1) {
- dev_err(wdt->dev,
- "Transition from fast to slow mode not allowed\n");
+ pr_err("watchdog%d: Transition from fast to slow mode not allowed\n",
+ wdt->id);
return -EINVAL;
}

--
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/