aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonrad Dybcio <[email protected]>2024-03-09 14:15:03 +0100
committerDaniel Lezcano <[email protected]>2024-04-23 12:40:29 +0200
commitd9d3490c48df572edefc0b64655259eefdcbb9be (patch)
tree60e3594f697541b7bbc85e3450c41c9a8a1e95aa
parentc0f14ec95262cdcf557016f84b87e45f54e0b881 (diff)
thermal/drivers/qcom/lmh: Check for SCM availability at probe
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: <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Konrad Dybcio <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-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 f6edb12ec004..5225b3621a56 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;