Linux MultiMedia Card development
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam via B4 Relay <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org>
To: Bjorn Andersson <andersson@kernel.org>,
	 Konrad Dybcio <konradybcio@kernel.org>,
	Abel Vesa <abel.vesa@linaro.org>,
	 Adrian Hunter <adrian.hunter@intel.com>,
	 Ulf Hansson <ulf.hansson@linaro.org>,
	 Manivannan Sadhasivam <mani@kernel.org>,
	 "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	 "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org,
	 Sumit Garg <sumit.garg@oss.qualcomm.com>,
	mani@kernel.org,
	 Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Subject: [PATCH v2 2/4] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
Date: Tue, 10 Feb 2026 12:26:51 +0530	[thread overview]
Message-ID: <20260210-qcom-ice-fix-v2-2-9c1ab5d6502c@oss.qualcomm.com> (raw)
In-Reply-To: <20260210-qcom-ice-fix-v2-0-9c1ab5d6502c@oss.qualcomm.com>

From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>

devm_of_qcom_ice_get() currently returns NULL if ICE SCM is not available or
"qcom,ice" property is not found in DT. But this confuses the clients since
NULL doesn't convey the reason for failure. So return proper error codes
instead of NULL.

Reported-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
 drivers/soc/qcom/ice.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index 8e25609c7e7b..498cb0e0d1e4 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -563,7 +563,7 @@ static struct qcom_ice *qcom_ice_create(struct device *dev,
 
 	if (!qcom_scm_ice_available()) {
 		dev_warn(dev, "ICE SCM interface not found\n");
-		return NULL;
+		return ERR_PTR(-EOPNOTSUPP);
 	}
 
 	engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL);
@@ -641,7 +641,7 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
 	struct device_node *node __free(device_node) = of_parse_phandle(dev->of_node,
 									"qcom,ice", 0);
 	if (!node)
-		return NULL;
+		return ERR_PTR(-ENODEV);
 
 	pdev = of_find_device_by_node(node);
 	if (!pdev) {
@@ -697,8 +697,7 @@ static void devm_of_qcom_ice_put(struct device *dev, void *res)
  * Devres automatically decrements the refcount when consumer device gets
  * destroyed and frees the ICE instance when the last consumer goes away.
  *
- * Return: ICE pointer on success, NULL if there is no ICE data provided by the
- * consumer or ERR_PTR() on error.
+ * Return: ICE pointer on success, ERR_PTR() on error.
  */
 struct qcom_ice *devm_of_qcom_ice_get(struct device *dev)
 {
@@ -709,7 +708,7 @@ struct qcom_ice *devm_of_qcom_ice_get(struct device *dev)
 		return ERR_PTR(-ENOMEM);
 
 	ice = of_qcom_ice_get(dev);
-	if (!IS_ERR_OR_NULL(ice)) {
+	if (!IS_ERR(ice)) {
 		*dr = ice;
 		devres_add(dev, dr);
 	} else {

-- 
2.51.0



  parent reply	other threads:[~2026-02-10  6:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-10  6:56 [PATCH v2 0/4] soc: qcom: ice: Remove platform_driver support and expose as a pure library Manivannan Sadhasivam via B4 Relay
2026-02-10  6:56 ` [PATCH v2 1/4] " Manivannan Sadhasivam via B4 Relay
2026-02-10  9:39   ` Konrad Dybcio
2026-02-10 12:08     ` Abel Vesa
2026-02-10 12:19     ` Manivannan Sadhasivam
2026-02-12 12:05       ` Konrad Dybcio
2026-02-13  1:02   ` Eric Biggers
2026-02-13  2:17     ` Manivannan Sadhasivam
2026-02-10  6:56 ` Manivannan Sadhasivam via B4 Relay [this message]
2026-02-10  9:32   ` [PATCH v2 2/4] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Konrad Dybcio
2026-02-10  6:56 ` [PATCH v2 3/4] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-02-10  8:37   ` Adrian Hunter
2026-02-10  9:32   ` Konrad Dybcio
2026-02-10 15:23   ` Ulf Hansson
2026-02-10  6:56 ` [PATCH v2 4/4] scsi: ufs: ufs-qcom: " Manivannan Sadhasivam via B4 Relay
2026-02-10  9:32   ` Konrad Dybcio
2026-02-10 13:43 ` [PATCH v2 0/4] soc: qcom: ice: Remove platform_driver support and expose as a pure library Ulf Hansson
2026-02-10 13:54   ` Manivannan Sadhasivam

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=20260210-qcom-ice-fix-v2-2-9c1ab5d6502c@oss.qualcomm.com \
    --to=devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=abel.vesa@linaro.org \
    --cc=adrian.hunter@intel.com \
    --cc=andersson@kernel.org \
    --cc=konradybcio@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=martin.petersen@oracle.com \
    --cc=sumit.garg@oss.qualcomm.com \
    --cc=ulf.hansson@linaro.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox