[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1584940131-1591-1-git-send-email-neeraju@codeaurora.org>
Date: Mon, 23 Mar 2020 10:38:51 +0530
From: Neeraj Upadhyay <neeraju@...eaurora.org>
To: rjw@...ysocki.net, pavel@....cz, len.brown@...el.com,
gregkh@...uxfoundation.org, swboyd@...omium.org
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
irgeorgiev@...eaurora.org, linux-arm-msm@...r.kernel.org,
Neeraj Upadhyay <neeraju@...eaurora.org>
Subject: [PATCH] PM / wakeup: Skip wakeup_source_sysfs_remove if device is not added
Skip wakeup_source_sysfs_remove(), to fix null pinter access of
ws->dev, if wakeup source is unregistered before wakeup class
is registered from device_add().
Fixes: 2ca3d1ecb8c4 ("PM / wakeup: Register wakeup class kobj after device is added")
Signed-off-by: Neeraj Upadhyay <neeraju@...eaurora.org>
---
drivers/base/power/wakeup.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index 27f3e60..f8f8c0a 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -241,7 +241,8 @@ void wakeup_source_unregister(struct wakeup_source *ws)
{
if (ws) {
wakeup_source_remove(ws);
- wakeup_source_sysfs_remove(ws);
+ if (ws->dev)
+ wakeup_source_sysfs_remove(ws);
wakeup_source_destroy(ws);
}
}
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of the Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists