Commit f2090ebd authored by Christian Marangi's avatar Christian Marangi Committed by Bjorn Andersson
Browse files

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



Commit 7a94d5f3 ("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: 7a94d5f3 ("soc: qcom: smem: better track SMEM uninitialized state")
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/aSAnR3ECa04CoPqp@stanley.mountain/


Signed-off-by: default avatarChristian Marangi <ansuelsmth@gmail.com>
Reviewed-by: default avatarKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20251122185002.26524-1-ansuelsmth@gmail.com


Signed-off-by: default avatarBjorn Andersson <andersson@kernel.org>
parent 8f0b4cce
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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[] = {