Skip to contentSkip to conversation

soc: qcom: smem: fix qcom_smem_is_available and check if __smem is valid

PATCH Applied Christian Marangi 3 participants 3 messages Nov 22, 2025 – Jan 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 soc: qcom: smem: fix qcom_smem_is_available and check if __smem is valid

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") changed the usage of __smem and init now as an error pointer instead of NULL.

qcom_smem_is_available() wasn't updated to reflect this change and also .qcom_smem_remove doesn't reset it on module exit.

Update both entry to reflect new handling of __smem.

Fixes 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state")

---
Changes v2:
- Drop unrelated changes

 drivers/soc/qcom/smem.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/soc/qcom/smem.c +3 -2
index fef840b54574..c18a0c946f76 100644
@@ -396,7 +396,7 @@ EXPORT_SYMBOL_GPL(qcom_smem_bust_hwspin_lock_by_host);
  */
 bool qcom_smem_is_available(void)
 {
-	return !!__smem;
+	return !IS_ERR(__smem);
 }
 EXPORT_SYMBOL_GPL(qcom_smem_is_available);
 
@@ -1247,7 +1247,8 @@ static void qcom_smem_remove(struct platform_device *pdev)
 {
 	platform_device_unregister(__smem->socinfo);
 
-	__smem = NULL;
+	/* Set to -EPROBE_DEFER to signal unprobed state */
+	__smem = ERR_PTR(-EPROBE_DEFER);
 }
 
 static const struct of_device_id qcom_smem_of_match[] = {
Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · Christian Marangi

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") changed the usage of __smem and init now as an error pointer instead of NULL.

qcom_smem_is_available() wasn't updated to reflect this change and also .qcom_smem_remove doesn't reset it on module exit.

Quoted 7 lines

Update both entry to reflect new handling of __smem.

Fixes 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state")

---

Konrad

maintainer Applied
#2 lore raw
In reply to Christian Marangi
Quoted 8 lines · Christian Marangi

Commit 7a94d5f31b54 ("soc: qcom: smem: better track SMEM uninitialized state") changed the usage of __smem and init now as an error pointer instead of NULL.

qcom_smem_is_available() wasn't updated to reflect this change and also .qcom_smem_remove doesn't reset it on module exit.

[...]

Applied, thanks!

[1/1] soc: qcom: smem: fix qcom_smem_is_available and check if __smem is valid

      commit: 0f727e88b8353fd75ed3afdac95703da0d007c23

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>