All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Bjorn Andersson <andersson@kernel.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>,
	 Daniel Lezcano <daniel.lezcano@linaro.org>,
	Zhang Rui <rui.zhang@intel.com>,
	 Lukasz Luba <lukasz.luba@arm.com>, Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	 Thara Gopinath <thara.gopinath@gmail.com>,
	Amit Kucheria <amitk@kernel.org>
Cc: Marijn Suijten <marijn.suijten@somainline.org>,
	 linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	 devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	 Konrad Dybcio <konrad.dybcio@linaro.org>,
	stable@vger.kernel.org
Subject: [PATCH v2 2/3] thermal: qcom: lmh: Check for SCM availability at probe
Date: Sat, 09 Mar 2024 14:15:03 +0100	[thread overview]
Message-ID: <20240308-topic-rb1_lmh-v2-2-bac3914b0fe3@linaro.org> (raw)
In-Reply-To: <20240308-topic-rb1_lmh-v2-0-bac3914b0fe3@linaro.org>

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>
Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
---
 drivers/thermal/qcom/lmh.c | 3 +++
 1 file changed, 3 insertions(+)

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;

-- 
2.44.0


  parent reply	other threads:[~2024-03-09 13:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-09 13:15 [PATCH v2 0/3] QCM2290 LMH Konrad Dybcio
2024-03-09 13:15 ` [PATCH v2 1/3] dt-bindings: thermal: lmh: Add QCM2290 compatible Konrad Dybcio
2024-03-10  8:49   ` Krzysztof Kozlowski
2024-03-21 17:13   ` Daniel Lezcano
2024-05-14 10:18   ` [thermal: thermal/fixes] " thermal-bot for Konrad Dybcio
2024-03-09 13:15 ` Konrad Dybcio [this message]
2024-03-18  1:27   ` [PATCH v2 2/3] thermal: qcom: lmh: Check for SCM availability at probe Bjorn Andersson
2024-03-21 17:13   ` Daniel Lezcano
2024-05-14 10:18   ` [thermal: thermal/fixes] thermal/drivers/qcom/lmh: " thermal-bot for Konrad Dybcio
2024-03-09 13:15 ` [PATCH v2 3/3] arm64: dts: qcom: qcm2290: Add LMH node Konrad Dybcio
2024-03-19  2:48 ` (subset) [PATCH v2 0/3] QCM2290 LMH Bjorn Andersson
2024-03-20 19:08 ` Nícolas F. R. A. Prado
2024-03-25 19:48   ` Konrad Dybcio
2024-03-25 19:59   ` Krzysztof Kozlowski
2024-03-25 23:01     ` Nícolas F. R. A. Prado
2024-03-26  6:29       ` Krzysztof Kozlowski
2024-03-26 14:07         ` Nícolas F. R. A. Prado
2024-03-27  4:04           ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308-topic-rb1_lmh-v2-2-bac3914b0fe3@linaro.org \
    --to=konrad.dybcio@linaro.org \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=marijn.suijten@somainline.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=thara.gopinath@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.