remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()
PATCH 1/1 remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()
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.
--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2 -2
@@ -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 -EBUSY ; } kproc->mem[i].bus_addr = res->start; kproc->mem[i].dev_addr = data->mems[i].dev_addr;
Signature · 1 line
2.17.1
Quoted 3 lines · YueHaibing
In case of error, the function
devm_ioremap_wc()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.
Thanks for the fix.
Quoted 2 lines
Fixes 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs")
This should instead be
With that,
Quoted 23 lines
Signed-off-by YueHaibing <[email protected]>--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/remoteproc/ti_k3_dsp_remoteproc.c +2
-2@@ -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 -EBUSY ; } kproc->mem[i].bus_addr = res->start; kproc->mem[i].dev_addr = data->mems[i].dev_addr;
Mathieu Poirier
maintainerQuoted 15 lines · YueHaibing
In case of error, the function
devm_ioremap_wc()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Fixes 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs")Signed-off-by YueHaibing <[email protected]>--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/remoteproc/ti_k3_dsp_remoteproc.c +0
-0
drivers/remoteproc/ti_k3_dsp_remoteproc.c static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev, · line 451
Quoted 9 lines
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2
-2@@ -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 -EBUSY ;
Shouldn't this be -ENOMEM?
Quoted 7 lines
drivers/remoteproc/ti_k3_dsp_remoteproc.c +0
-0} kproc->mem[i].bus_addr = res->start; kproc->mem[i].dev_addr = data->mems[i].dev_addr;Signature · 1 line
2.17.1
Quoted 17 lines · Mathieu Poirier
Quoted 16 lines · YueHaibing
In case of error, the function
devm_ioremap_wc()returns NULL pointer notERR_PTR(). TheIS_ERR()test in the return value check should be replaced with NULL test.Fixes 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs")Signed-off-by YueHaibing <[email protected]>--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/remoteproc/ti_k3_dsp_remoteproc.c +0
-0@@ -445,10 +445,10 @@ static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev,
Quoted 10 lines
drivers/remoteproc/ti_k3_dsp_remoteproc.c static int k3_dsp_rproc_of_get_memories(struct platform_device *pdev, · line 451
Quoted 8 lines
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2
-2kproc->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 -EBUSY ;Shouldn't this be
-ENOMEM?
Indeed, thanks for catching it.
I will fix these same issues on the K3 R5F driver for v4.
regards
Suman
Quoted 8 lines
Quoted 8 lines
drivers/remoteproc/ti_k3_dsp_remoteproc.c +0
-0} kproc->mem[i].bus_addr = res->start; kproc->mem[i].dev_addr = data->mems[i].dev_addr;Signature · 1 line
2.17.1
PATCH v2 1/1 remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()
In reply to YueHaibingIn 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.
---
v2: return ENOMEM instead of EBUSY, use corret Fixes tag
--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/remoteproc/ti_k3_dsp_remoteproc.c +2 -2
@@ -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.17.1
Quoted 7 lines · YueHaibing
In case of error, the function
devm_ioremap_wc()returns NULL pointer notERR_PTR(). TheIS_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")Signed-off-by YueHaibing <[email protected]>Acked-by Suman Anna <[email protected]>
Quoted 27 lines
---
v2: return ENOMEM instead of EBUSY, use corret Fixes tag--- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/remoteproc/ti_k3_dsp_remoteproc.c +2
-2@@ -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.17.1
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 Sat, 5 Sep 2020 20:25:03 +0800 you wrote:
In case of error, the function
devm_ioremap_wc()returns NULL pointer notERR_PTR(). TheIS_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")Signed-off-by YueHaibing <[email protected]>Acked-by Suman Anna <[email protected]>[...]
Here is the summary with links:
- [v2,-next] remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories()
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