]> git.ipfire.org Git - thirdparty/linux.git/commit
soc: qcom: smem: better track SMEM uninitialized state
authorChristian Marangi <ansuelsmth@gmail.com>
Fri, 31 Oct 2025 13:08:33 +0000 (14:08 +0100)
committerBjorn Andersson <andersson@kernel.org>
Sat, 1 Nov 2025 17:46:12 +0000 (12:46 -0500)
commit7a94d5f31b549e18f908cb669c59f066f45a21c7
treedf7ada9e1e474d641aa1b110231eddbdbd0bb464
parent652a86b24c5ac444afaf7625c9340d55aab7f105
soc: qcom: smem: better track SMEM uninitialized state

There is currently a problem where, in the specific case of SMEM not
initialized by SBL, any SMEM API wrongly returns PROBE_DEFER
communicating wrong info to any user of this API.

A better way to handle this would be to track the SMEM state and return
a different kind of error than PROBE_DEFER.

Rework the __smem handle to always init it to the error pointer
-EPROBE_DEFER following what is already done by the SMEM API.
If we detect that the SBL didn't initialized SMEM, set the __smem handle
to the error pointer -ENODEV.
Also rework the SMEM API to handle the __smem handle to be an error
pointer and return it appropriately.

This way user of the API can react and return a proper error or use
fallback way for the failing API.

While at it, change the return error when SMEM is not initialized by SBL
also to -ENODEV to make it consistent with the __smem handle and use
dev_err_probe() helper to return the message.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://lore.kernel.org/r/20251031130835.7953-3-ansuelsmth@gmail.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/smem.c