* [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get()
@ 2026-03-02 13:00 Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 1/5] " Manivannan Sadhasivam via B4 Relay
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam, stable, Konrad Dybcio
Hi,
This series fixes the race betwen qcom_ice_probe() and of_qcom_ice_get()
but synchronizing the two APIs and properly propagating the error codes to
clients.
Merge Strategy
==============
Due to dependency, all patches should go through Qcom SoC tree.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
Changes in v4:
- For supporting multi-ice instances in a SoC, stored the err ptr in platform
drvdata instead of in a global pointer.
- Link to v3: https://lore.kernel.org/r/20260223-qcom-ice-fix-v3-0-6ca5846329f7@oss.qualcomm.com
Changes in v3:
- Dropped the platform driver removal patch and used the ice_handle to pass
error codes. This was done as I learned that we need to have the platform
driver design going forward and also removing it introduces other issues.
- Link to v2: https://lore.kernel.org/r/20260210-qcom-ice-fix-v2-0-9c1ab5d6502c@oss.qualcomm.com
Changes in v2:
- Added MODULE_* macros back
- Removed spurious platform_device_put()
- Added patches to remove NULL return
---
Manivannan Sadhasivam (5):
soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get()
soc: qcom: ice: Return -ENODEV if the ICE platform device is not found
soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get()
scsi: ufs: ufs-qcom: Remove NULL check from devm_of_qcom_ice_get()
drivers/mmc/host/sdhci-msm.c | 10 +++++-----
drivers/soc/qcom/ice.c | 33 ++++++++++++++++++++++-----------
drivers/ufs/host/ufs-qcom.c | 10 +++++-----
3 files changed, 32 insertions(+), 21 deletions(-)
---
base-commit: 6de23f81a5e08be8fbf5e8d7e9febc72a5b5f27f
change-id: 20260210-qcom-ice-fix-d2a3a045b32d
Best regards,
--
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 1/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get()
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
@ 2026-03-02 13:00 ` Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 2/5] soc: qcom: ice: Return -ENODEV if the ICE platform device is not found Manivannan Sadhasivam via B4 Relay
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam, stable
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
The current platform driver design causes probe ordering races with
consumers (UFS, eMMC) due to ICE's dependency on SCM firmware calls. If ICE
probe fails (missing ICE SCM or DT registers), devm_of_qcom_ice_get() loops
with -EPROBE_DEFER, leaving consumers non-functional even when ICE should
be gracefully disabled. devm_of_qcom_ice_get() doesn't know if the ICE
driver probe has failed due to above reasons or it is waiting for the SCM
driver.
Moreover, there is no devlink dependency between ICE and consumer drivers
as 'qcom,ice' is not considered as a DT 'supplier'. So the consumer drivers
have no idea of when the ICE driver is going to probe.
To address these issues, store the error pointer in the platform drvdata
during probe in addition to the valid ice pointer and synchronize both
qcom_ice_probe() and of_qcom_ice_get() using a mutex.
If the platform drvdata is NULL, then it implies that the driver is not
probed yet, so return -EPROBE_DEFER. If it has any error pointer, return
that error pointer directly.
Note that this change only fixes the standalone ICE DT node bindings and
not the ones with 'ice' range embedded in the consumer nodes, where there
is no issue.
Cc: <stable@vger.kernel.org> # 6.4
Fixes: 2afbf43a4aec ("soc: qcom: Make the Qualcomm UFS/SDCC ICE a dedicated driver")
Reported-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/soc/qcom/ice.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index b203bc685cad..a7e7e2251015 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -113,6 +113,8 @@ struct qcom_ice {
u8 hwkm_version;
};
+static DEFINE_MUTEX(ice_mutex);
+
static bool qcom_ice_check_supported(struct qcom_ice *ice)
{
u32 regval = qcom_ice_readl(ice, QCOM_ICE_REG_VERSION);
@@ -631,6 +633,8 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
return qcom_ice_create(&pdev->dev, base);
}
+ guard(mutex)(&ice_mutex);
+
/*
* If the consumer node does not provider an 'ice' reg range
* (legacy DT binding), then it must at least provide a phandle
@@ -648,11 +652,12 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
}
ice = platform_get_drvdata(pdev);
- if (!ice) {
- dev_err(dev, "Cannot get ice instance from %s\n",
- dev_name(&pdev->dev));
+ if (IS_ERR_OR_NULL(ice)) {
platform_device_put(pdev);
- return ERR_PTR(-EPROBE_DEFER);
+ if (!ice)
+ return ERR_PTR(-EPROBE_DEFER);
+ else
+ return ice;
}
link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
@@ -719,15 +724,22 @@ static int qcom_ice_probe(struct platform_device *pdev)
struct qcom_ice *engine;
void __iomem *base;
+ guard(mutex)(&ice_mutex);
+
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base)) {
dev_warn(&pdev->dev, "ICE registers not found\n");
+ /* Store the error pointer for devm_of_qcom_ice_get() */
+ platform_set_drvdata(pdev, base);
return PTR_ERR(base);
}
engine = qcom_ice_create(&pdev->dev, base);
- if (IS_ERR(engine))
+ if (IS_ERR(engine)) {
+ /* Store the error pointer for devm_of_qcom_ice_get() */
+ platform_set_drvdata(pdev, engine);
return PTR_ERR(engine);
+ }
platform_set_drvdata(pdev, engine);
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 2/5] soc: qcom: ice: Return -ENODEV if the ICE platform device is not found
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 1/5] " Manivannan Sadhasivam via B4 Relay
@ 2026-03-02 13:00 ` Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Manivannan Sadhasivam via B4 Relay
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
By the time the consumer driver calls devm_of_qcom_ice_get(), all the
platform devices for ICE nodes would've been created by
of_platform_default_populate().
So for the absence of any platform device, -ENODEV should not returned, not
-EPROBE_DEFER.
Fixes: 2afbf43a4aec ("soc: qcom: Make the Qualcomm UFS/SDCC ICE a dedicated driver")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/soc/qcom/ice.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index a7e7e2251015..833d23dc7b06 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -648,7 +648,7 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
pdev = of_find_device_by_node(node);
if (!pdev) {
dev_err(dev, "Cannot find device node %s\n", node->name);
- return ERR_PTR(-EPROBE_DEFER);
+ return ERR_PTR(-ENODEV);
}
ice = platform_get_drvdata(pdev);
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 1/5] " Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 2/5] soc: qcom: ice: Return -ENODEV if the ICE platform device is not found Manivannan Sadhasivam via B4 Relay
@ 2026-03-02 13:00 ` Manivannan Sadhasivam via B4 Relay
2026-03-06 8:47 ` Sumit Garg
2026-03-02 13:00 ` [PATCH v4 4/5] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 5/5] scsi: ufs: ufs-qcom: " Manivannan Sadhasivam via B4 Relay
4 siblings, 1 reply; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam, Konrad Dybcio
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>
Reviewed-by: Konrad Dybcio <konrad.dybcio@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 833d23dc7b06..d1efc676b63c 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -561,7 +561,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);
@@ -643,7 +643,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) {
@@ -696,8 +696,7 @@ static void devm_of_qcom_ice_put(struct device *dev, void *res)
* phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
* be created and so this function will return that instead.
*
- * 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)
{
@@ -708,7 +707,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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 4/5] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get()
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
` (2 preceding siblings ...)
2026-03-02 13:00 ` [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Manivannan Sadhasivam via B4 Relay
@ 2026-03-02 13:00 ` Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 5/5] scsi: ufs: ufs-qcom: " Manivannan Sadhasivam via B4 Relay
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Now since the devm_of_qcom_ice_get() API never returns NULL, remove the
NULL check and also simplify the error handling.
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/mmc/host/sdhci-msm.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 3b85233131b3..8d862079cf17 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -1906,14 +1906,14 @@ static int sdhci_msm_ice_init(struct sdhci_msm_host *msm_host,
return 0;
ice = devm_of_qcom_ice_get(dev);
- if (ice == ERR_PTR(-EOPNOTSUPP)) {
+ if (IS_ERR(ice)) {
+ if (ice != ERR_PTR(-EOPNOTSUPP))
+ return PTR_ERR(ice);
+
dev_warn(dev, "Disabling inline encryption support\n");
- ice = NULL;
+ return 0;
}
- if (IS_ERR_OR_NULL(ice))
- return PTR_ERR_OR_ZERO(ice);
-
if (qcom_ice_get_supported_key_type(ice) != BLK_CRYPTO_KEY_TYPE_RAW) {
dev_warn(dev, "Wrapped keys not supported. Disabling inline encryption support.\n");
return 0;
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 5/5] scsi: ufs: ufs-qcom: Remove NULL check from devm_of_qcom_ice_get()
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
` (3 preceding siblings ...)
2026-03-02 13:00 ` [PATCH v4 4/5] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
@ 2026-03-02 13:00 ` Manivannan Sadhasivam via B4 Relay
4 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam via B4 Relay @ 2026-03-02 13:00 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, Abel Vesa
Cc: linux-arm-msm, linux-kernel, linux-mmc, linux-scsi, Sumit Garg,
mani, Neeraj Soni, Manivannan Sadhasivam, Konrad Dybcio
From: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Now since the devm_of_qcom_ice_get() API never returns NULL, remove the
NULL check and also simplify the error handling.
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com> # UFS
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
---
drivers/ufs/host/ufs-qcom.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 375fd24ba458..72c24ed65fe1 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -177,14 +177,14 @@ static int ufs_qcom_ice_init(struct ufs_qcom_host *host)
int i;
ice = devm_of_qcom_ice_get(dev);
- if (ice == ERR_PTR(-EOPNOTSUPP)) {
+ if (IS_ERR(ice)) {
+ if (ice != ERR_PTR(-EOPNOTSUPP))
+ return PTR_ERR(ice);
+
dev_warn(dev, "Disabling inline encryption support\n");
- ice = NULL;
+ return 0;
}
- if (IS_ERR_OR_NULL(ice))
- return PTR_ERR_OR_ZERO(ice);
-
host->ice = ice;
/* Initialize the blk_crypto_profile */
--
2.51.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
2026-03-02 13:00 ` [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Manivannan Sadhasivam via B4 Relay
@ 2026-03-06 8:47 ` Sumit Garg
2026-03-06 9:00 ` Sumit Garg
0 siblings, 1 reply; 9+ messages in thread
From: Sumit Garg @ 2026-03-06 8:47 UTC (permalink / raw)
To: manivannan.sadhasivam
Cc: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, linux-arm-msm, linux-kernel, linux-mmc, linux-scsi,
Neeraj Soni, Konrad Dybcio
Hey Mani,
On Mon, Mar 2, 2026 at 6:30 PM Manivannan Sadhasivam via B4 Relay
<devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote:
>
> 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>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@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 833d23dc7b06..d1efc676b63c 100644
> --- a/drivers/soc/qcom/ice.c
> +++ b/drivers/soc/qcom/ice.c
> @@ -561,7 +561,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);
> }
With this patch-set on top of v7.0-rc2, I still see UFS probe failing
when ICE isn't supported with OP-TEE as follows:
[ 5.401558] qcom-ice 1d88000.crypto: ICE SCM interface not found
[ 5.419482] qcom-ice 1d88000.crypto: probe with driver qcom-ice
failed with error -95
<snip>
[ 18.662977] ufshcd-qcom 1d84000.ufshc: freq-table-hz property not specified
[ 18.670193] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg: Unable
to find vdd-hba-supply regulator, assuming enabled
[ 18.737665] platform 1d84000.ufshc: deferred probe pending:
ufshcd-qcom: ufshcd_pltfrm_init() failed
[ 18.747141] platform 3370000.codec: deferred probe pending:
platform: wait for supplier /soc@0/pinctrl@33c0000/dmic23-data-state
Maybe it's the "qcom-ice" driver failure leading to this deferred
probe problem again.
-Sumit
>
> engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL);
> @@ -643,7 +643,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) {
> @@ -696,8 +696,7 @@ static void devm_of_qcom_ice_put(struct device *dev, void *res)
> * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
> * be created and so this function will return that instead.
> *
> - * 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)
> {
> @@ -708,7 +707,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
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
2026-03-06 8:47 ` Sumit Garg
@ 2026-03-06 9:00 ` Sumit Garg
2026-03-06 14:34 ` Manivannan Sadhasivam
0 siblings, 1 reply; 9+ messages in thread
From: Sumit Garg @ 2026-03-06 9:00 UTC (permalink / raw)
To: manivannan.sadhasivam
Cc: Bjorn Andersson, Konrad Dybcio, Adrian Hunter, Ulf Hansson,
Manivannan Sadhasivam, James E.J. Bottomley, Martin K. Petersen,
Abel Vesa, linux-arm-msm, linux-kernel, linux-mmc, linux-scsi,
Neeraj Soni, Konrad Dybcio
On Fri, Mar 6, 2026 at 2:17 PM Sumit Garg <sumit.garg@oss.qualcomm.com> wrote:
>
> Hey Mani,
>
> On Mon, Mar 2, 2026 at 6:30 PM Manivannan Sadhasivam via B4 Relay
> <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote:
> >
> > 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>
> > Reviewed-by: Konrad Dybcio <konrad.dybcio@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 833d23dc7b06..d1efc676b63c 100644
> > --- a/drivers/soc/qcom/ice.c
> > +++ b/drivers/soc/qcom/ice.c
> > @@ -561,7 +561,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);
> > }
>
> With this patch-set on top of v7.0-rc2, I still see UFS probe failing
> when ICE isn't supported with OP-TEE as follows:
>
> [ 5.401558] qcom-ice 1d88000.crypto: ICE SCM interface not found
> [ 5.419482] qcom-ice 1d88000.crypto: probe with driver qcom-ice
> failed with error -95
> <snip>
> [ 18.662977] ufshcd-qcom 1d84000.ufshc: freq-table-hz property not specified
> [ 18.670193] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg: Unable
> to find vdd-hba-supply regulator, assuming enabled
> [ 18.737665] platform 1d84000.ufshc: deferred probe pending:
> ufshcd-qcom: ufshcd_pltfrm_init() failed
> [ 18.747141] platform 3370000.codec: deferred probe pending:
> platform: wait for supplier /soc@0/pinctrl@33c0000/dmic23-data-state
>
> Maybe it's the "qcom-ice" driver failure leading to this deferred
> probe problem again.
>
Following diff on top of your patchset allows the UFS driver to probe
successfully without ICE support. I suppose just setting the drvdata
should be sufficient.
diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index d1efc676b63c..a86980647097 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -734,12 +734,6 @@ static int qcom_ice_probe(struct platform_device *pdev)
}
engine = qcom_ice_create(&pdev->dev, base);
- if (IS_ERR(engine)) {
- /* Store the error pointer for devm_of_qcom_ice_get() */
- platform_set_drvdata(pdev, engine);
- return PTR_ERR(engine);
- }
-
platform_set_drvdata(pdev, engine);
-Sumit
>
> >
> > engine = devm_kzalloc(dev, sizeof(*engine), GFP_KERNEL);
> > @@ -643,7 +643,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) {
> > @@ -696,8 +696,7 @@ static void devm_of_qcom_ice_put(struct device *dev, void *res)
> > * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
> > * be created and so this function will return that instead.
> > *
> > - * 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)
> > {
> > @@ -708,7 +707,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
> >
> >
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
2026-03-06 9:00 ` Sumit Garg
@ 2026-03-06 14:34 ` Manivannan Sadhasivam
0 siblings, 0 replies; 9+ messages in thread
From: Manivannan Sadhasivam @ 2026-03-06 14:34 UTC (permalink / raw)
To: Sumit Garg
Cc: manivannan.sadhasivam, Bjorn Andersson, Konrad Dybcio,
Adrian Hunter, Ulf Hansson, James E.J. Bottomley,
Martin K. Petersen, Abel Vesa, linux-arm-msm, linux-kernel,
linux-mmc, linux-scsi, Neeraj Soni, Konrad Dybcio
On Fri, Mar 06, 2026 at 02:30:02PM +0530, Sumit Garg wrote:
> On Fri, Mar 6, 2026 at 2:17 PM Sumit Garg <sumit.garg@oss.qualcomm.com> wrote:
> >
> > Hey Mani,
> >
> > On Mon, Mar 2, 2026 at 6:30 PM Manivannan Sadhasivam via B4 Relay
> > <devnull+manivannan.sadhasivam.oss.qualcomm.com@kernel.org> wrote:
> > >
> > > 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>
> > > Reviewed-by: Konrad Dybcio <konrad.dybcio@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 833d23dc7b06..d1efc676b63c 100644
> > > --- a/drivers/soc/qcom/ice.c
> > > +++ b/drivers/soc/qcom/ice.c
> > > @@ -561,7 +561,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);
> > > }
> >
> > With this patch-set on top of v7.0-rc2, I still see UFS probe failing
> > when ICE isn't supported with OP-TEE as follows:
> >
> > [ 5.401558] qcom-ice 1d88000.crypto: ICE SCM interface not found
> > [ 5.419482] qcom-ice 1d88000.crypto: probe with driver qcom-ice
> > failed with error -95
> > <snip>
> > [ 18.662977] ufshcd-qcom 1d84000.ufshc: freq-table-hz property not specified
> > [ 18.670193] ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg: Unable
> > to find vdd-hba-supply regulator, assuming enabled
> > [ 18.737665] platform 1d84000.ufshc: deferred probe pending:
> > ufshcd-qcom: ufshcd_pltfrm_init() failed
> > [ 18.747141] platform 3370000.codec: deferred probe pending:
> > platform: wait for supplier /soc@0/pinctrl@33c0000/dmic23-data-state
> >
> > Maybe it's the "qcom-ice" driver failure leading to this deferred
> > probe problem again.
> >
Urgh... I completely forgot that the driver core removes the drvdata during
probe error >.<
>
> Following diff on top of your patchset allows the UFS driver to probe
> successfully without ICE support. I suppose just setting the drvdata
> should be sufficient.
>
> diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
> index d1efc676b63c..a86980647097 100644
> --- a/drivers/soc/qcom/ice.c
> +++ b/drivers/soc/qcom/ice.c
> @@ -734,12 +734,6 @@ static int qcom_ice_probe(struct platform_device *pdev)
> }
>
> engine = qcom_ice_create(&pdev->dev, base);
> - if (IS_ERR(engine)) {
> - /* Store the error pointer for devm_of_qcom_ice_get() */
> - platform_set_drvdata(pdev, engine);
> - return PTR_ERR(engine);
> - }
> -
No, this will indicate probe success which we do not want and is not safe all
the time. Like what if qcom_ice_create() returned -EPROBE_DEFER.
Let me just store the ice_handle in a global xarray with key based on node
phandle instead of drvdata. This will ensure that the pointer stays till the
driver is loaded.
- Mani
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-03-06 14:34 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-02 13:00 [PATCH v4 0/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 1/5] " Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 2/5] soc: qcom: ice: Return -ENODEV if the ICE platform device is not found Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Manivannan Sadhasivam via B4 Relay
2026-03-06 8:47 ` Sumit Garg
2026-03-06 9:00 ` Sumit Garg
2026-03-06 14:34 ` Manivannan Sadhasivam
2026-03-02 13:00 ` [PATCH v4 4/5] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get() Manivannan Sadhasivam via B4 Relay
2026-03-02 13:00 ` [PATCH v4 5/5] scsi: ufs: ufs-qcom: " Manivannan Sadhasivam via B4 Relay
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®