Skip to contentSkip to conversation

remoteproc: k3-dsp: Fix return value check in devm_ioremap_uc()

PATCH Applied Wang Li 3 participants 3 messages Nov 13, 2020 – Nov 18, 2020 Remote processor (remoteproc)

lore
Share & tools
lore

Wang Li

author
#0 lore raw

PATCH 1/1 remoteproc: k3-dsp: Fix return value check in devm_ioremap_uc()

In case of error, the function devm_ioremap_wc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 6edbe024ba17 ("remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs")
---
 drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2 -2
index 9011e477290c..863c0214e0a8 100644
@@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev,
 
 		kproc->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start,
 							 resource_size(res));
-		if (IS_ERR(kproc->mem[i].cpu_addr)) {
+		if (!kproc->mem[i].cpu_addr) {
 			dev_err(dev, "failed to map %s memory\n",
 				data->mems[i].name);
-			return PTR_ERR(kproc->mem[i].cpu_addr);
+			return -ENOMEM;
 		}
 		kproc->mem[i].bus_addr = res->start;
 		kproc->mem[i].dev_addr = data->mems[i].dev_addr;
Signature · 1 line
2.25.4
#1 lore raw

Hi Wang,

Quoted 7 lines · Wang Li

In case of error, the function devm_ioremap_wc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 6edbe024ba17 ("remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs")

Hmm, a patch was already posted for this previously, looks like it got missed somehow.

https://patchwork.kernel.org/project/linux-remoteproc/patch/[email protected]/

Bjorn,
Can you pick up the previous patch that was already acked by me and Mathieu? Appreciate it if you can include it in your fixes branch for 5.10 itself.

regards
Suman

Quoted 22 lines
---
 drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2 -2
index 9011e477290c..863c0214e0a8 100644
@@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev,
 
 		kproc->mem[i].cpu_addr = devm_ioremap_wc(dev, res->start,
 							 resource_size(res));
-		if (IS_ERR(kproc->mem[i].cpu_addr)) {
+		if (!kproc->mem[i].cpu_addr) {
 			dev_err(dev, "failed to map %s memory\n",
 				data->mems[i].name);
-			return PTR_ERR(kproc->mem[i].cpu_addr);
+			return -ENOMEM;
 		}
 		kproc->mem[i].bus_addr = res->start;
 		kproc->mem[i].dev_addr = data->mems[i].dev_addr;
#2 lore raw
In reply to Wang Li
This patch was applied to andersson/remoteproc.git (refs/heads/for-next):

Hello:

This patch was applied to andersson/remoteproc.git (refs/heads/for-next):

Quoted 9 lines · On Fri, 13 Nov 2020 15:08:40 +0800 you wrote:

In case of error, the function devm_ioremap_wc() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 6edbe024ba17 ("remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs")

[...]

Here is the summary with links:
- remoteproc: k3-dsp: Fix return value check in devm_ioremap_uc()

    https://git.kernel.org/andersson/remoteproc/c/9b3b3c9531e8

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html