* [PATCH] watchdog: sprd: Fix the incorrect pointer getting from driver data
@ 2019-11-08 10:57 Baolin Wang
2019-11-08 14:24 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Baolin Wang @ 2019-11-08 10:57 UTC (permalink / raw)
To: wim, linux
Cc: orsonzhai, zhang.lyra, baolin.wang, baolin.wang7, dongwei.wang,
shuiqing.li, linux-watchdog, linux-kernel
From: Shuiqing Li <shuiqing.li@unisoc.com>
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: 477603467009 ("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>
---
drivers/watchdog/sprd_wdt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
index 0bb17b0..65cb55f 100644
--- a/drivers/watchdog/sprd_wdt.c
+++ b/drivers/watchdog/sprd_wdt.c
@@ -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);
@@ -339,7 +338,6 @@ 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;
@@ -347,7 +345,7 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev)
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);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: sprd: Fix the incorrect pointer getting from driver data
2019-11-08 10:57 [PATCH] watchdog: sprd: Fix the incorrect pointer getting from driver data Baolin Wang
@ 2019-11-08 14:24 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-11-08 14:24 UTC (permalink / raw)
To: Baolin Wang, wim
Cc: orsonzhai, zhang.lyra, baolin.wang7, dongwei.wang, shuiqing.li,
linux-watchdog, linux-kernel
On 11/8/19 2:57 AM, Baolin Wang wrote:
> From: Shuiqing Li <shuiqing.li@unisoc.com>
>
> 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: 477603467009 ("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>
> ---
> drivers/watchdog/sprd_wdt.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
> index 0bb17b0..65cb55f 100644
> --- a/drivers/watchdog/sprd_wdt.c
> +++ b/drivers/watchdog/sprd_wdt.c
> @@ -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);
>
> @@ -339,7 +338,6 @@ 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;
>
> @@ -347,7 +345,7 @@ static int __maybe_unused sprd_wdt_pm_resume(struct device *dev)
> 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);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-08 14:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 10:57 [PATCH] watchdog: sprd: Fix the incorrect pointer getting from driver data Baolin Wang
2019-11-08 14:24 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).