[PATCH] soc: qcom: llcc-qcom: Fix error check for devm_memremap()

Chen Ni posted 1 patch 6 days ago
drivers/soc/qcom/llcc-qcom.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] soc: qcom: llcc-qcom: Fix error check for devm_memremap()
Posted by Chen Ni 6 days ago
The devm_memremap() function returns an error pointer on failure, not
NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly
handle allocation failures.

Fixes: ac23106a9b9a ("soc: qcom: llcc-qcom: get SCT descriptors from fw-populated memory")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
 drivers/soc/qcom/llcc-qcom.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/qcom/llcc-qcom.c b/drivers/soc/qcom/llcc-qcom.c
index dcc08f63e020..2006bfe198ea 100644
--- a/drivers/soc/qcom/llcc-qcom.c
+++ b/drivers/soc/qcom/llcc-qcom.c
@@ -5231,9 +5231,9 @@ static int qcom_llcc_get_fw_config(struct platform_device *pdev)
 	}
 
 	slc_mem = devm_memremap(dev, res.start, resource_size(&res), MEMREMAP_WB);
-	if (!slc_mem) {
+	if (IS_ERR(slc_mem)) {
 		dev_err(dev, "Failed to memremap SLC shared memory\n");
-		return -ENOMEM;
+		return PTR_ERR(slc_mem);
 	}
 
 	ret = qcom_llcc_verify_fw_config(dev, slc_mem);
-- 
2.25.1
Re: [PATCH] soc: qcom: llcc-qcom: Fix error check for devm_memremap()
Posted by Markus Elfring 5 days, 17 hours ago
> The devm_memremap() function returns an error pointer on failure, not
> NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly
> handle allocation failures.

Would a summary phrase like “Fix error handling in qcom_llcc_get_fw_config()”
be more appropriate?

Regards,
Markus
Re: [PATCH] soc: qcom: llcc-qcom: Fix error check for devm_memremap()
Posted by Konrad Dybcio 5 days, 18 hours ago
On 5/19/26 4:38 AM, Chen Ni wrote:
> The devm_memremap() function returns an error pointer on failure, not
> NULL. Fix the check to use IS_ERR() and return PTR_ERR() to correctly
> handle allocation failures.
> 
> Fixes: ac23106a9b9a ("soc: qcom: llcc-qcom: get SCT descriptors from fw-populated memory")
> Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>

Konrad