From nobody Thu Apr 9 13:37:03 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84B8127B343; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; cv=none; b=Lg8SdMei+REdZ/iB6iC2xwBnrYWbgSHkuleZhvPqKH0oU1TGhatrI3TVk+ljdyJMd4dQ/RyRBvI6xIx/pdhp17mfPWDJze3hbmvkgc/Xu5L6kzruoDXFo+oWluUtjp4GNC5NQvPXYRe5ihq1WrD+1lufaLx3Yu9RMyDLfXWzib0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; c=relaxed/simple; bh=idcDeAlJQXfXyS4G3nzM1x69kvurnmzd3DZy9RI8eyE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p8UDACVbbJq6yw9cbwYkgAuHoXHhbc/0RONM/vKbRKpwFCKyoiGNNLbm13OzQjLDE2DRVQuItx8gw1s05DiYGKKgCQf+eDej/DMNcAgMwEoAbOKqspi3Rs7zY4RztJt1QF42XksWmlMw4ynVoSnlr4gbiOZQ3De/UdsVpJsb0Pg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qX/ZsgpO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qX/ZsgpO" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2BAB9C2BC86; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772951267; bh=idcDeAlJQXfXyS4G3nzM1x69kvurnmzd3DZy9RI8eyE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qX/ZsgpOHtpc7HTc1bPQbb2V66jhj0nMDCGPiWEGW3gH9zzqp745AjQ6Dapz6kFug BiMYKVkhWqx9khLUoxC3GH8Y+8YR5HJOi/gRY/x8GIqo5tlz3lXKbf1URW51mVRlvF VbtqGAoTXRc5hq7BRG+t4wtdtphf+Ypzcj7b7qKphM83xUTphDHIQUKoDUiUMm2fkU CPRA/Sqr9QUtjUCVJrDvDCSFITNnJ8zQlasniqYVnliTxUpMsZQnV6I595W9ZOtHNR 69zpfeNM0g5MrPEJEv+vx/oluWPHd2DkPLEXQ7C1rkC9Q91dkecI7xKwtgLJsZexAQ GJvosoHonmhrA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13613F5512F; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Sun, 08 Mar 2026 11:57:27 +0530 Subject: [PATCH v5 1/5] soc: qcom: ice: Fix race between qcom_ice_probe() and of_qcom_ice_get() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260308-qcom-ice-fix-v5-1-e47e8a44b6c4@oss.qualcomm.com> References: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> In-Reply-To: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> 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@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Sumit Garg , mani@kernel.org, Neeraj Soni , Manivannan Sadhasivam , stable@vger.kernel.org X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=4898; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=2PuOSvq7nnlpuETEJ0CuJEYnb+PMzyX987WVqcITQEY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBprRbgN42Q1bJ36wY0Z+wzx33nXWRl1JS3i5Cc/ WYi0GuSPP+JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaa0W4AAKCRBVnxHm/pHO 9Q17CACpB7yHxnQYQwOxBVaBRncoamYSOyVYZ9oASA+7vlAPonPKzSJXB6oJYHByUMj6Pzc0ofN 4stdbJlXSC+m8W9eZmJfnyzcoAxcQMrLcOOAqBQXApkrLBeqJFXnH1pA+MPvtToZ723bNCaop1H nMpXFYj4eDAQGGgr737ds4OTUirkggNeOfLLTikat7/I3G+/dtJ3ej7Jx0MnzadezOOa3C0iXiP z8hC0xemduki4128S17Mjun8itYC1JDPpi3l1JzC1+n0tGn5j3eS6BLYqy6+yDpytaGmrC7Jmyf pyiSuHSPELE1IMaKDyvXb06xBC6Y+AqZyBxv/zMEk6XF4K8r X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 a global xarray with ice node phandle as a key 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 xarray entry 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. Otherwise, add the devlink as usual and return the valid pointer to the consumer. Xarray is used instead of platform drvdata, since driver core frees the drvdata during probe failure. So it cannot be used to pass the error pointer to the consumers. 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: # 6.4 Fixes: 2afbf43a4aec ("soc: qcom: Make the Qualcomm UFS/SDCC ICE a dedicated= driver") Reported-by: Sumit Garg Signed-off-by: Manivannan Sadhasivam --- drivers/soc/qcom/ice.c | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c index b203bc685cad..50da5a3e8073 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include =20 @@ -113,6 +114,9 @@ struct qcom_ice { u8 hwkm_version; }; =20 +DEFINE_XARRAY(ice_handles); +static DEFINE_MUTEX(ice_mutex); + static bool qcom_ice_check_supported(struct qcom_ice *ice) { u32 regval =3D qcom_ice_readl(ice, QCOM_ICE_REG_VERSION); @@ -631,6 +635,8 @@ static struct qcom_ice *of_qcom_ice_get(struct device *= dev) return qcom_ice_create(&pdev->dev, base); } =20 + 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 @@ -647,12 +653,13 @@ static struct qcom_ice *of_qcom_ice_get(struct device= *dev) return ERR_PTR(-EPROBE_DEFER); } =20 - ice =3D platform_get_drvdata(pdev); - if (!ice) { - dev_err(dev, "Cannot get ice instance from %s\n", - dev_name(&pdev->dev)); + ice =3D xa_load(&ice_handles, pdev->dev.of_node->phandle); + 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; } =20 link =3D device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER); @@ -716,24 +723,40 @@ EXPORT_SYMBOL_GPL(devm_of_qcom_ice_get); =20 static int qcom_ice_probe(struct platform_device *pdev) { + unsigned long phandle =3D pdev->dev.of_node->phandle; struct qcom_ice *engine; void __iomem *base; =20 + guard(mutex)(&ice_mutex); + base =3D 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() */ + xa_store(&ice_handles, phandle, base, GFP_KERNEL); return PTR_ERR(base); } =20 engine =3D qcom_ice_create(&pdev->dev, base); - if (IS_ERR(engine)) + if (IS_ERR(engine)) { + /* Store the error pointer for devm_of_qcom_ice_get() */ + xa_store(&ice_handles, phandle, engine, GFP_KERNEL); return PTR_ERR(engine); + } =20 - platform_set_drvdata(pdev, engine); + xa_store(&ice_handles, phandle, engine, GFP_KERNEL); =20 return 0; } =20 +static void qcom_ice_remove(struct platform_device *pdev) +{ + unsigned long phandle =3D pdev->dev.of_node->phandle; + + guard(mutex)(&ice_mutex); + xa_store(&ice_handles, phandle, NULL, GFP_KERNEL); +} + static const struct of_device_id qcom_ice_of_match_table[] =3D { { .compatible =3D "qcom,inline-crypto-engine" }, { }, @@ -742,6 +765,7 @@ MODULE_DEVICE_TABLE(of, qcom_ice_of_match_table); =20 static struct platform_driver qcom_ice_driver =3D { .probe =3D qcom_ice_probe, + .remove =3D qcom_ice_remove, .driver =3D { .name =3D "qcom-ice", .of_match_table =3D qcom_ice_of_match_table, --=20 2.51.0 From nobody Thu Apr 9 13:37:03 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84B17254B19; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; cv=none; b=QOv1W+QPkVQiR3YLIpOPBUjRRbWbCTTAE1lImcwMmRdQWKVncv+ZIa1z977AhTbiZxiv+gNwStwO/2qP8I5x+nAQ5W7oJ1Khuw6XSMmMMM3ulJ8ptndD2oIKBxd1Td13FBZCedpGLamQjRP/HNw3ZG087a+3v/aYC2BXu2Hi2J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; c=relaxed/simple; bh=0UKxxiZfM0kQax41QXFKMk/OoypvkFiAYGIhYtQPXLE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YwGCxdTunbrojzplw5vDaAbj5VkJWT0qv9jOpfcaGtdHKTWYdG5Fos9MszdP/VKwpji2smF2crQy1QDXceyMsJH3Pske4Rqx/YL5tsSnnBJ/BuZjdE2H2hcyaAMzjPEXA7ZzZ5H8t0PBnX66LgENhvK2KrA5lLVOOuWWpSLMvvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XjpqyhmW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XjpqyhmW" Received: by smtp.kernel.org (Postfix) with ESMTPS id 373EBC2BC87; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772951267; bh=0UKxxiZfM0kQax41QXFKMk/OoypvkFiAYGIhYtQPXLE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XjpqyhmWnP7z0kLrAlcsHM0xZdXU9GL4MN/4IEO646NQGcJ3+Ih0XlX89xKbVZnb4 MowNLIVEo1zymT90lpIAZ5NmQBIBRPr/hsuKn6W2dFpC8U59q7be6QgIvgf3oNZZ4g fY3n9p7yN2jpJQ6VyPPvsd4pMzRHxDbtt3LZ/S3lSUkvEQ8rSyZPjAeM0h988/E2qd YhjYGSmM3r51T6a7gnr9073xORA+Ojd0dgxH46ZUUMw3f91nQWx5Zza0/XzcHr2dy6 S9Dongz0Dkh5doNk9qr8HT7JWFs5ggBNy70eMaa5+22XL4fuIZludPztcR4QjEwkMD X6NSIty2nBhbg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23537F55132; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Sun, 08 Mar 2026 11:57:28 +0530 Subject: [PATCH v5 2/5] soc: qcom: ice: Return -ENODEV if the ICE platform device is not found Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260308-qcom-ice-fix-v5-2-e47e8a44b6c4@oss.qualcomm.com> References: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> In-Reply-To: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> 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@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Sumit Garg , mani@kernel.org, Neeraj Soni , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1019; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=qK8flUkY0AriLSe7KcyTU7F/qyhSLO0EesRORdT3ebw=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBprRbgpEihdBq/VekYMOVpYQpxR2dndsZ0jfLVc f/e3W4jLH6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaa0W4AAKCRBVnxHm/pHO 9TeLCACNEQZO5ZWO2YQTSc4uFt1AiK9S4awX4aq1UZie2nSbEgl8Ip/AleqS9vFyBx3RJhaiZxR EZtqRzRakfe2Xvzes7MZqM1HB4qTiDXAJrG6znGrX3EfaVIDQGciyqw9MWB6W9JjK/DNEgi1qzx TtfNaPUxRRtY2noVeZCLO3cf6spd1/kkDo4WUjJxR8o5h6vLEmxuiTpXfAzokdPtzifK3CyEQ1y ePIm1HjLIP7d77xbnL1+ypVQAgizz12mrRLNqRZPnrUyrpbh8SA+g71nCAeZQPhXpqP2i0bcanp vNjsqTYHh839x9inqvexMrbyZW66SzZ+sbcjLSxM71pZlufD X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 --- 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 50da5a3e8073..6fde282584d0 100644 --- a/drivers/soc/qcom/ice.c +++ b/drivers/soc/qcom/ice.c @@ -650,7 +650,7 @@ static struct qcom_ice *of_qcom_ice_get(struct device *= dev) pdev =3D 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); } =20 ice =3D xa_load(&ice_handles, pdev->dev.of_node->phandle); --=20 2.51.0 From nobody Thu Apr 9 13:37:03 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84AB21FBEA6; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; cv=none; b=Aq841trZt5f+JWzZSX9mT6etBtBG4MkXTcv9uORcBvJqayAPFvjBB9t883xtKm2CjdOXOEYlqE1QnL4jc8PofGT7at0RO07e+bBofMkDLgGFF18GgvY+pvj1mbkJ9RnMVTLMPdi9aQ+YwcfjLxZVUMqSvykIMMvI7YsysM2QYN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; c=relaxed/simple; bh=LJCdrjh5v923RUukUeQhbZ+wVdbGpVFn1ddvq4HPACk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EPWk7MzFlqLvO8RKiuCOmZqQylTLjKxVh2V2P/4tuth4oOx2CHvo6EAnMvSAuk47LKDxs9hz4MYcb2M9/aXrbHo6GiQdt745ce4p/2o2LefMM/xWrKQFJJW+dfZ7X5PB/TExrxYDMe2GV4US0WfuIEJMpBX2bwe5FUcYTK4c7j0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hGRBIHev; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hGRBIHev" Received: by smtp.kernel.org (Postfix) with ESMTPS id 441C8C2BCB1; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772951267; bh=LJCdrjh5v923RUukUeQhbZ+wVdbGpVFn1ddvq4HPACk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=hGRBIHev4i76DQ7S9gbOut30KdIk1ravHqeh6jSCMP3pnW6/1Y/62F4ubNBCuz8iA AIxtJDU5NqXEClUPozxFmz6/2CTy7xXLueoPL5o7CZOzLVNtnQDmSU5j3mNy/VJUmh ci9zJo4WLFhdypR4Jx5rReV/ZxUcU8VKvVFyqHIbvUx7AhYWzBEuTnDEI1vXaQLoxA rDFKhcOGHFg+9OU1FeGA9vNpJKlGXL75TDlrasA8GPJIDwypKbov0EI6D/yOI29ILg RPPg1fqaYq5o3jB3cJVKz+55ZOfmPIr0Y+nqXbADtPxUX8C/SNdxULuouCal6Y0GBh F88nAeBDlDQpQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 331ABF55137; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Sun, 08 Mar 2026 11:57:29 +0530 Subject: [PATCH v5 3/5] soc: qcom: ice: Return proper error codes from devm_of_qcom_ice_get() instead of NULL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260308-qcom-ice-fix-v5-3-e47e8a44b6c4@oss.qualcomm.com> References: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> In-Reply-To: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> 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@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Sumit Garg , mani@kernel.org, Neeraj Soni , Manivannan Sadhasivam , Konrad Dybcio X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2044; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=5W0UnK5qBpVdfnHU+nHM5UdWdtySo1GeLE5V9qhPunU=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBprRbgWc3KZRLBWyRJTbhO7t36Vij9aWQSEiGST OV4hRQp4K6JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaa0W4AAKCRBVnxHm/pHO 9S6JB/9q+7rJhXTC7lYqxlaBySKsDLOPKEB9XiY19E7mEGK+qtj/sQ3zANElxjJM6xUC3xdJWJa fCXhHLb3ZXwHh9fP3EqAAW965o+m/Kkfe5t8w0wllLl20Aofwy6gTGNn2ZO9UasdNIlQNswWAdv MOaprm8yd24iMeG4Pli8yLh3GegteuDiBNWXya2YtxOFub7YuXC2sUcEfW7cXSXNwE6/RYIQrJ8 gr3IAyuw/NzXpzWwdtReNHZSEbvccFS1pkfaMUtdbQL8Xt8E1QrXCnmnS5+mOApvjb4N4uEv6LK YvTC5lvEFWmzmhJwghfdaWTrP3V0vATKsFtY4V5ciCFEClNi X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 Reviewed-by: Konrad Dybcio Signed-off-by: Manivannan Sadhasivam --- 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 6fde282584d0..9faf099e40a3 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, =20 if (!qcom_scm_ice_available()) { dev_warn(dev, "ICE SCM interface not found\n"); - return NULL; + return ERR_PTR(-EOPNOTSUPP); } =20 engine =3D 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) =3D of_parse_phandle(dev->of= _node, "qcom,ice", 0); if (!node) - return NULL; + return ERR_PTR(-ENODEV); =20 pdev =3D of_find_device_by_node(node); if (!pdev) { @@ -698,8 +698,7 @@ static void devm_of_qcom_ice_put(struct device *dev, vo= id *res) * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will alr= eady * be created and so this function will return that instead. * - * Return: ICE pointer on success, NULL if there is no ICE data provided b= y 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 *de= v) return ERR_PTR(-ENOMEM); =20 ice =3D of_qcom_ice_get(dev); - if (!IS_ERR_OR_NULL(ice)) { + if (!IS_ERR(ice)) { *dr =3D ice; devres_add(dev, dr); } else { --=20 2.51.0 From nobody Thu Apr 9 13:37:04 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99619281341; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; cv=none; b=oDaW9nVPKFz8tQHU0HI49icR6peBHs4Y4vbpwIQfKMk7TJH93SM7CCAR/bFToc6Tu1vZ0GiLbofJ8Fs7YfeeROCTTQLrrExWt0T+wi12Lm7OMszeDfhMlb4pf6FOW/umTbOhedAATSHAYG/XRrIRyV8F47S3qyEXtJEMX5vldU4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; c=relaxed/simple; bh=fIjVtLv2PApm9p7zByR7Rq2/I5Linm9JuIiBx8Q7GZw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aHcY0pRXWkQ8oTTkJHSyXRrXTG+VTY5xI871iiYVV0XQYqWxyB84ZQgqwQmPsUSEq8SOd5AKO1RrmsGSThNB9y5hjX1qEFkLYnc9aexHBzOH4Uq1zMG+IDpFP89/uNTs48Hw+jGfY2r5RnA5QaO825ezT5ZQWhqdgdeQqLk2OZY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=B3Y/acYo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="B3Y/acYo" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4E96AC2BCB6; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772951267; bh=fIjVtLv2PApm9p7zByR7Rq2/I5Linm9JuIiBx8Q7GZw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=B3Y/acYo2FkfD1vlElVdU28nvshBPHSo9ryLp2AiPgCFvKpdVmyvp66ARN32kfKZt S04RtYub7loN0JbqCevT1dWIzW2wjDHZXx2TrmXUgJQ4duDjzpMHuClMlgff3evuPJ WshNSd3icipKF2Nt30SQFjtIJwvlHOKCl5RPIdna3u9G4Y+s1aMpx3iwsooJVzXnmb J7vdQQR4co9D57n/yVplbfZvr8iRZ0kP2Fvfr/QXMXHyEhZfxctOil96nhjqwEdinO dbZyAKImzwRtTWC34n08W8+8IzicVKQ2VmX+HI2sLWPaG4W+j96powDaqsaBZ7wdZl nHefRMcf1gxQA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 425EEF55135; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Sun, 08 Mar 2026 11:57:30 +0530 Subject: [PATCH v5 4/5] mmc: sdhci-msm: Remove NULL check from devm_of_qcom_ice_get() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260308-qcom-ice-fix-v5-4-e47e8a44b6c4@oss.qualcomm.com> References: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> In-Reply-To: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> 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@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Sumit Garg , mani@kernel.org, Neeraj Soni , Manivannan Sadhasivam , Konrad Dybcio X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1276; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=+5SkLtRpHTnkAQ9yZWBecUdG7TMHCu1aRwm2dHYl1LQ=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBprRbg3Cz6bK26QOY62/c6UWOBHA3aXHsClixEO 292pI7+u2GJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaa0W4AAKCRBVnxHm/pHO 9Y5+CAConNhiN8qSUsh6NQaEuvrKUDN7B2cOyQLAIDZCu/y3Hue1w4SlnJKseZerR3aEVbE9WYV p14Ec66Wf6gsOSo8gm+UIhR6hGqpKhmXNoXucwoxQ0Gz3r74R1mA+ZrsjiSJ+ZY8ZiRJ0racD32 Vy8weiA0cO058iXLl1YWTo/BZxsixYmWJOiawvLQoEOjPhbxWNAdu6n7QfhWiU4tujB429GZp/G U0teMB2GDLXoYMW69uiJpes0NYOeUFPbDeeFaw55KCG9mff9wb6GqyJM5mdRgDJIB7dcS01ZNH0 EEo1RcCA9dDewIJf2j2iI2RdkSJraHJ0xJ+yZE9ovp0a+tPE X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 Acked-by: Ulf Hansson Acked-by: Adrian Hunter Signed-off-by: Manivannan Sadhasivam --- 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; =20 ice =3D devm_of_qcom_ice_get(dev); - if (ice =3D=3D ERR_PTR(-EOPNOTSUPP)) { + if (IS_ERR(ice)) { + if (ice !=3D ERR_PTR(-EOPNOTSUPP)) + return PTR_ERR(ice); + dev_warn(dev, "Disabling inline encryption support\n"); - ice =3D NULL; + return 0; } =20 - if (IS_ERR_OR_NULL(ice)) - return PTR_ERR_OR_ZERO(ice); - if (qcom_ice_get_supported_key_type(ice) !=3D BLK_CRYPTO_KEY_TYPE_RAW) { dev_warn(dev, "Wrapped keys not supported. Disabling inline encryption s= upport.\n"); return 0; --=20 2.51.0 From nobody Thu Apr 9 13:37:04 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1EF02E5B2D; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; cv=none; b=Un0PAGYBLj+RzMh2ojtOHiKTovzJyu0s+FuS7MCIrIxpOXZQffgwPq0e6QX27jXvGe0B62FAwodTxVGYn4tDTvko/AwP4rsgsk/1so/u8sz6QeHrCbIhKDcTNNH6c6HHnyeVavBPTTtm5Ydhml2Rxb9t0ZGaB/UoVf5ecpHG13M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772951267; c=relaxed/simple; bh=1eHoa0JSRx58JXoaHKKDpiP/1IcF5/5fTgcvM3Fey2g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aNRwSCEC+dISqz5qDrj7E2Og9WHBgT9XjAmZua+of2qGCnXuM4orP83IKOaMUvbAWQIJsDDUKj7kKHIR2BPdG5ZOwjK9Go7A9AGCwk66Zs4hKMnNgVB3TtirOdG/V9OSl8O7nlLhwYYj8aEAEqzvGjIgplv3LEOuZOiu1JPvyII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZHrTQ+Hg; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZHrTQ+Hg" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5F8AFC2BCC7; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772951267; bh=1eHoa0JSRx58JXoaHKKDpiP/1IcF5/5fTgcvM3Fey2g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ZHrTQ+Hg/cGtPDsOfuu819bYycup4rhABpjztxHAcX/2dOXYx7LGWbHFXeki2xs+K Ri8lfdppXHO+nSUX8rl1EwQHChcRlm5BeduS+w2o7E3UbKCz6zp3yjiu/17XAbMcAb wHfyUfWEnp1Wvdw+CGVmQUFJYNvTorvt/vcfRF5mf5L8+8s35Vt+b402DohXZOpHS3 GE/aKLK1/pKAa7o+B38/H1Tb3Bm8nFnim2I+hLCR5/OiV3ncKM7a5RDLpcHdUBRG26 FFWoDFBWnL0hOiyJYUMXc7dMV/9Xa54RahlhmZUPDOf+NmFag+FcWcuhBbeMpazUZ6 HqBEMckckozjw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5290BF55139; Sun, 8 Mar 2026 06:27:47 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Sun, 08 Mar 2026 11:57:31 +0530 Subject: [PATCH v5 5/5] scsi: ufs: ufs-qcom: Remove NULL check from devm_of_qcom_ice_get() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260308-qcom-ice-fix-v5-5-e47e8a44b6c4@oss.qualcomm.com> References: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> In-Reply-To: <20260308-qcom-ice-fix-v5-0-e47e8a44b6c4@oss.qualcomm.com> 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@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-scsi@vger.kernel.org, Sumit Garg , mani@kernel.org, Neeraj Soni , Manivannan Sadhasivam , Konrad Dybcio X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1114; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=TzqKhDLr9WN8kubHG4egYv7EvzBCe1kNbA4zOiRN8WE=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBprRbgLn3T61wt6ZIws4U8+iZm85mLQbn2L0LkB jdNzTJQG/eJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaa0W4AAKCRBVnxHm/pHO 9Sq9CACAtzJB/b5B7KU1tuGKHbiIGzaq0+XkeDdRyZbJO+T0RjlwkPKJZNd3fDUK4VS98edK5is O3MkCT7wwlUQzuveyx7fOf2Wh9FbHMV5ZC296eI/T0rWOmNjkohqQhj2Pwbxy9HQSTl2O8cskqK eIEp6ldnBqfI+X0DeDs+u0zUut9t//dQWd9tDiCUfcr1aDLLFTTem77Hg88osY2F+iv8Iz3N5xb DI8H7jE6cTJxa9LvLNrmbIB4kQlF+bYEZtHjH4CW0SCH8joAeVOQGyO1aeL9RDwRkygjjRVuxZ0 Cp9T13UpXDJXDhPyNKLCjXCFyPRcepiDqkqM7J/vpDmKZ82w X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam 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 Acked-by: Martin K. Petersen # UFS Signed-off-by: Manivannan Sadhasivam --- 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 *ho= st) int i; =20 ice =3D devm_of_qcom_ice_get(dev); - if (ice =3D=3D ERR_PTR(-EOPNOTSUPP)) { + if (IS_ERR(ice)) { + if (ice !=3D ERR_PTR(-EOPNOTSUPP)) + return PTR_ERR(ice); + dev_warn(dev, "Disabling inline encryption support\n"); - ice =3D NULL; + return 0; } =20 - if (IS_ERR_OR_NULL(ice)) - return PTR_ERR_OR_ZERO(ice); - host->ice =3D ice; =20 /* Initialize the blk_crypto_profile */ --=20 2.51.0