Re: [PATCH v7 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL
From: Marek Szyprowski
Date: Tue May 19 2026 - 14:29:33 EST
On 18.05.2026 15:52, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxxx>
> Reviewed-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
> Tested-by: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx> # OP-TEE as TZ
> Acked-by: Sumit Garg <sumit.garg@xxxxxxxxxxxxxxxx>
> Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxxxxxxxx>
This patch landed in today's linux-next as commit b9ab7217dd7d ("soc: qcom: ice:
Return proper error codes from devm_of_qcom_ice_get() instead of NULL"). In my
tests I found that it breaks booting from the UFS storage on the RB5 board:
ufshcd-qcom 1d84000.ufshc: freq-table-hz property not specified
ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg: Unable to find vdd-hba-supply regulator, assuming enabled
ufshcd-qcom 1d84000.ufshc: freq-table-hz property not specified
ufshcd-qcom 1d84000.ufshc: ufshcd_populate_vreg: Unable to find vdd-hba-supply regulator, assuming enabled
ufshcd-qcom 1d84000.ufshc: error -ENODEV: ufshcd_variant_hba_init: variant qcom init failed with err -19
ufshcd-qcom 1d84000.ufshc: error -ENODEV: Initialization failed with error -19
ufshcd-qcom 1d84000.ufshc: error -ENODEV: ufshcd_pltfrm_init() failed
/dev/root: Can't open blockdev
VFS: Cannot open root device "/dev/sda8" or unknown-block(0,0): error -6
...
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 7 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.1.0-rc1+ #12707 PREEMPT
Hardware name: Qualcomm Technologies, Inc. Robotics RB5 (DT)
> ---
> 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 85deb9ea4a68..2b592aa42941 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);
> @@ -645,7 +645,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) {
> @@ -698,8 +698,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)
> {
> @@ -710,7 +709,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 {
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland