Skip to content

Commit 39e68d9

Browse files
Shuiqing LiWim Van Sebroeck
authored andcommitted
watchdog: sprd: Fix the incorrect pointer getting from driver data
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 <[email protected]> Signed-off-by: Shuiqing Li <[email protected]> Signed-off-by: Baolin Wang <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/76d4687189ec940baa90cb8d679a8d4c8f02ee80.1573210405.git.baolin.wang@linaro.org Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent c045712 commit 39e68d9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/watchdog/sprd_wdt.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,9 @@ static int sprd_wdt_probe(struct platform_device *pdev)
327327

328328
static int __maybe_unused sprd_wdt_pm_suspend(struct device *dev)
329329
{
330-
struct watchdog_device *wdd = dev_get_drvdata(dev);
331330
struct sprd_wdt *wdt = dev_get_drvdata(dev);
332331

333-
if (watchdog_active(wdd))
332+
if (watchdog_active(&wdt->wdd))
334333
sprd_wdt_stop(&wdt->wdd);
335334
sprd_wdt_disable(wdt);
336335

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

340339
static int __maybe_unused sprd_wdt_pm_resume(struct device *dev)
341340
{
342-
struct watchdog_device *wdd = dev_get_drvdata(dev);
343341
struct sprd_wdt *wdt = dev_get_drvdata(dev);
344342
int ret;
345343

346344
ret = sprd_wdt_enable(wdt);
347345
if (ret)
348346
return ret;
349347

350-
if (watchdog_active(wdd)) {
348+
if (watchdog_active(&wdt->wdd)) {
351349
ret = sprd_wdt_start(&wdt->wdd);
352350
if (ret) {
353351
sprd_wdt_disable(wdt);

0 commit comments

Comments
 (0)