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: 53bca371cd ("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>
This commit is contained in:
Konrad Dybcio 2024-03-09 14:15:03 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель c422e1d407
Коммит 2226b145af
1 изменённых файлов: 3 добавлений и 0 удалений

Просмотреть файл

@ -92,6 +92,9 @@ static int lmh_probe(struct platform_device *pdev)
int temp_low, temp_high, temp_arm, cpu_id, ret; int temp_low, temp_high, temp_arm, cpu_id, ret;
u32 node_id; u32 node_id;
if (!qcom_scm_is_available())
return -EPROBE_DEFER;
lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL); lmh_data = devm_kzalloc(dev, sizeof(*lmh_data), GFP_KERNEL);
if (!lmh_data) if (!lmh_data)
return -ENOMEM; return -ENOMEM;