summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorKonrad Dybcio <konrad.dybcio@linaro.org>2024-03-09 16:15:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-16 14:41:33 +0300
commit560d69c975072974c11434ca6953891e74c1a665 (patch)
tree65c14b49866712276a30429d01c7a5d7e9b3907c /drivers/thermal
parent5e0d41aa533ef4ceee39aef74c588b30d4e6229c (diff)
downloadlinux-560d69c975072974c11434ca6953891e74c1a665.tar.xz
thermal/drivers/qcom/lmh: Check for SCM availability at probe
commit d9d3490c48df572edefc0b64655259eefdcbb9be upstream. Up until now, the necessary scm availability check has not been performed, leading to possible null pointer dereferences (which did happen for me on RB1). Fix that. Fixes: 53bca371cdf7 ("thermal/drivers/qcom: Add support for LMh driver") Cc: <stable@vger.kernel.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Bjorn Andersson <andersson@kernel.org> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20240308-topic-rb1_lmh-v2-2-bac3914b0fe3@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/qcom/lmh.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
index 4122a51e9874..97cf0dc3a6c3 100644
--- a/drivers/thermal/qcom/lmh.c
+++ b/drivers/thermal/qcom/lmh.c
@@ -95,6 +95,9 @@ static int lmh_probe(struct platform_device *pdev)
unsigned int enable_alg;
u32 node_id;
+ if (!qcom_scm_is_available())
+ return -EPROBE_DEFER;
+
lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL);
if (!lmh_data)
return -ENOMEM;