aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-21 22:07:01 -0500
committerWim Van Sebroeck <wim@iguana.be>2013-01-02 06:06:49 -0500
commit98e4a293895dda2b74476ac3a9f79c58b5d0155a (patch)
treed79ceba10dcf42c5c416b685aa80b2f047054d6b /drivers
parentee8c94adff9bd8609e70fb2ecdfaa71f561ed40d (diff)
watchdog: da9055: Don't update wdt_dev->timeout in da9055_wdt_set_timeout error path
Otherwise, WDIOC_GETTIMEOUT returns wrong value if set_timeout fails. This patch also removes unnecessary ret variable in da9055_wdt_ping function. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/watchdog/da9055_wdt.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c
index 31d537959bcc..f5ad10546fc9 100644
--- a/drivers/watchdog/da9055_wdt.c
+++ b/drivers/watchdog/da9055_wdt.c
@@ -72,20 +72,21 @@ static int da9055_wdt_set_timeout(struct watchdog_device *wdt_dev,
72 DA9055_TWDSCALE_MASK, 72 DA9055_TWDSCALE_MASK,
73 da9055_wdt_maps[i].reg_val << 73 da9055_wdt_maps[i].reg_val <<
74 DA9055_TWDSCALE_SHIFT); 74 DA9055_TWDSCALE_SHIFT);
75 if (ret < 0) 75 if (ret < 0) {
76 dev_err(da9055->dev, 76 dev_err(da9055->dev,
77 "Failed to update timescale bit, %d\n", ret); 77 "Failed to update timescale bit, %d\n", ret);
78 return ret;
79 }
78 80
79 wdt_dev->timeout = timeout; 81 wdt_dev->timeout = timeout;
80 82
81 return ret; 83 return 0;
82} 84}
83 85
84static int da9055_wdt_ping(struct watchdog_device *wdt_dev) 86static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
85{ 87{
86 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev); 88 struct da9055_wdt_data *driver_data = watchdog_get_drvdata(wdt_dev);
87 struct da9055 *da9055 = driver_data->da9055; 89 struct da9055 *da9055 = driver_data->da9055;
88 int ret;
89 90
90 /* 91 /*
91 * We have a minimum time for watchdog window called TWDMIN. A write 92 * We have a minimum time for watchdog window called TWDMIN. A write
@@ -94,10 +95,8 @@ static int da9055_wdt_ping(struct watchdog_device *wdt_dev)
94 mdelay(DA9055_TWDMIN); 95 mdelay(DA9055_TWDMIN);
95 96
96 /* Reset the watchdog timer */ 97 /* Reset the watchdog timer */
97 ret = da9055_reg_update(da9055, DA9055_REG_CONTROL_E, 98 return da9055_reg_update(da9055, DA9055_REG_CONTROL_E,
98 DA9055_WATCHDOG_MASK, 1); 99 DA9055_WATCHDOG_MASK, 1);
99
100 return ret;
101} 100}
102 101
103static void da9055_wdt_release_resources(struct kref *r) 102static void da9055_wdt_release_resources(struct kref *r)