mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] qcom: ice: Prevent client probe failures on unsupported ICE
@ 2025-10-21  4:03 Debraj Mukhopadhyay
  2025-10-21  9:27 ` Konrad Dybcio
  2025-10-27 18:26 ` Bjorn Andersson
  0 siblings, 2 replies; 5+ messages in thread
From: Debraj Mukhopadhyay @ 2025-10-21  4:03 UTC (permalink / raw)
  To: quic_neersoni, andersson, konradybcio, linux-arm-msm, linux-kernel
  Cc: Debraj Mukhopadhyay

Storage clients (ex. UFS and MMC) invoke of_qcom_ice_get() to obtain the
handle from ICE (Inline Crypto Engine) driver. Currently if ICE is
unsupported, the return code from probe could prevent the client
initialization which is a bug. To fix this a new flag
qcom_ice_create_error is introduced which caches the error encountered
during ICE probe.

The qcom_ice_create() and of_qcom_ice_get() functions are updated to
return -EOPNOTSUPP when ICE is unsupported, allowing clients to proceed
without ICE.

For other failures, such as ICE not yet initialized, the existing
behavior (e.g., -EPROBE_DEFER) is retained to ensure proper error
handling.

This improves error signaling and ensures that client initialization is
not blocked unnecessarily.

Signed-off-by: Debraj Mukhopadhyay <quic_dmukhopa@quicinc.com>
---
 drivers/soc/qcom/ice.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index c467b55b4174..5460436d9158 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -85,6 +85,8 @@ union crypto_cfg {
 #define qcom_ice_readl(engine, reg)	\
 	readl((engine)->base + (reg))
 
+static bool qcom_ice_create_error;
+
 static bool qcom_ice_use_wrapped_keys;
 module_param_named(use_wrapped_keys, qcom_ice_use_wrapped_keys, bool, 0660);
 MODULE_PARM_DESC(use_wrapped_keys,
@@ -524,7 +526,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);
@@ -604,7 +606,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(-EOPNOTSUPP);
 
 	pdev = of_find_device_by_node(node);
 	if (!pdev) {
@@ -617,7 +619,10 @@ static struct qcom_ice *of_qcom_ice_get(struct device *dev)
 		dev_err(dev, "Cannot get ice instance from %s\n",
 			dev_name(&pdev->dev));
 		platform_device_put(pdev);
-		return ERR_PTR(-EPROBE_DEFER);
+		if (qcom_ice_create_error)
+			return ERR_PTR(-EOPNOTSUPP);
+		else
+			return ERR_PTR(-EPROBE_DEFER);
 	}
 
 	link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
@@ -691,8 +696,10 @@ static int qcom_ice_probe(struct platform_device *pdev)
 	}
 
 	engine = qcom_ice_create(&pdev->dev, base);
-	if (IS_ERR(engine))
+	if (IS_ERR(engine)) {
+		qcom_ice_create_error = true;
 		return PTR_ERR(engine);
+	}
 
 	platform_set_drvdata(pdev, engine);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-10-27 18:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-21  4:03 [PATCH] qcom: ice: Prevent client probe failures on unsupported ICE Debraj Mukhopadhyay
2025-10-21  9:27 ` Konrad Dybcio
2025-10-21 12:34   ` Debraj Mukhopadhyay
2025-10-21 13:16     ` Konrad Dybcio
2025-10-27 18:26 ` Bjorn Andersson

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®