Skip to content

Commit

Permalink
watchdog: sprd: Fix the incorrect pointer getting from driver data
Browse files Browse the repository at this point in the history
The device driver data saved the 'struct sprd_wdt' object, it is
incorrect to get 'struct watchdog_device' object from the driver
data, thus fix it.

Fixes: 4776034 ("watchdog: Add Spreadtrum watchdog driver")
Reported-by: Dongwei Wang <dongwei.wang@unisoc.com>
Signed-off-by: Shuiqing Li <shuiqing.li@unisoc.com>
Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/76d4687189ec940baa90cb8d679a8d4c8f02ee80.1573210405.git.baolin.wang@linaro.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
  • Loading branch information
Shuiqing Li authored and Wim Van Sebroeck committed Nov 18, 2019
1 parent c045712 commit 39e68d9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/watchdog/sprd_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,9 @@ static int sprd_wdt_probe(struct platform_device *pdev)

static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev)
{
struct watchdog_device *wdd = dev_get_drvdata(dev);
struct sprd_wdt *wdt = dev_get_drvdata(dev);

if (watchdog_active(wdd))
if (watchdog_active(&wdt->wdd))
sprd_wdt_stop(&wdt->wdd);
sprd_wdt_disable(wdt);

Expand All @@ -339,15 +338,14 @@ static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev)

static int __maybe_unused sprd_wdt_pm_resume(struct device *dev)
{
struct watchdog_device *wdd = dev_get_drvdata(dev);
struct sprd_wdt *wdt = dev_get_drvdata(dev);
int ret;

ret = sprd_wdt_enable(wdt);
if (ret)
return ret;

if (watchdog_active(wdd)) {
if (watchdog_active(&wdt->wdd)) {
ret = sprd_wdt_start(&wdt->wdd);
if (ret) {
sprd_wdt_disable(wdt);
Expand Down

0 comments on commit 39e68d9

Please sign in to comment.