Skip to contentSkip to conversation

slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI

PATCH Applied Bjorn Andersson 3 participants 3 messages Nov 25, 2020 – Dec 29, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI

Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests.

Fixes 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")
---
 drivers/slimbus/qcom-ngd-ctrl.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/slimbus/qcom-ngd-ctrl.c +6 -0
index d8decb345e9d..c502e9e93965 100644
@@ -1229,6 +1229,9 @@ static int qcom_slim_ngd_runtime_resume(struct device *dev)
 	struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev);
 	int ret = 0;
 
+	if (!ctrl->qmi.handle)
+		return 0;
+
 	if (ctrl->state >= QCOM_SLIM_NGD_CTRL_ASLEEP)
 		ret = qcom_slim_ngd_power_up(ctrl);
 	if (ret) {
@@ -1616,6 +1619,9 @@ static int __maybe_unused qcom_slim_ngd_runtime_suspend(struct device *dev)
 	struct qcom_slim_ngd_ctrl *ctrl = dev_get_drvdata(dev);
 	int ret = 0;
 
+	if (!ctrl->qmi.handle)
+		return 0;
+
 	ret = qcom_slim_qmi_power_request(ctrl, false);
 	if (ret && ret != -EBUSY)
 		dev_info(ctrl->dev, "slim resource not idle:%d\n", ret);
Signature · 1 line
2.29.2
#1 lore raw
Quoted 7 lines · Bjorn Andersson

Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests.

Fixes 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")

Applied thanks,

--srini

#2 lore raw
In reply to Bjorn Andersson
This patch was applied to qcom/linux.git (refs/heads/for-next):

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

Quoted 9 lines · On Tue, 24 Nov 2020 21:42:55 -0800 you wrote:

Attempting to send a power request during PM operations, when the QMI handle isn't initialized results in a NULL pointer dereference. So check if the QMI handle has been initialized before attempting to post the power requests.

Fixes 917809e2280b ("slimbus: ngd: Add qcom SLIMBus NGD driver")

[...]

Here is the summary with links:
- slimbus: qcom-ngd-ctrl: Avoid sending power requests without QMI

    https://git.kernel.org/qcom/c/39014ce6d602

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html