Message ID | 20200902140614.28636-1-yuehaibing@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [-next] remoteproc: k3-dsp: Fix return value check in k3_dsp_rproc_of_get_memories() | expand |
On 9/2/20 9:06 AM, YueHaibing 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. Thanks for the fix. > > Fixes: 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs") This should instead be Fixes: 6edbe024ba17 ("remoteproc: k3-dsp: Add a remoteproc driver of K3 C66x DSPs") With that, Acked-by: Suman Anna <s-anna@ti.com> > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > index 9011e477290c..f373df35d7d0 100644 > --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c > +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > @@ -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; >
On Wed, Sep 02, 2020 at 10:06:14PM +0800, YueHaibing 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: 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs") > Signed-off-by: YueHaibing <yuehaibing@huawei.com> > --- > drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > index 9011e477290c..f373df35d7d0 100644 > --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c > +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c > @@ -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? > } > kproc->mem[i].bus_addr = res->start; > kproc->mem[i].dev_addr = data->mems[i].dev_addr; > -- > 2.17.1 > >
On 9/2/20 11:59 AM, Mathieu Poirier wrote: > On Wed, Sep 02, 2020 at 10:06:14PM +0800, YueHaibing 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: 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs") >> Signed-off-by: YueHaibing <yuehaibing@huawei.com> >> --- >> drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c >> index 9011e477290c..f373df35d7d0 100644 >> --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c >> +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c >> @@ -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? Indeed, thanks for catching it. I will fix these same issues on the K3 R5F driver for v4. regards Suman > >> } >> kproc->mem[i].bus_addr = res->start; >> kproc->mem[i].dev_addr = data->mems[i].dev_addr; >> -- >> 2.17.1 >> >>
diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c index 9011e477290c..f373df35d7d0 100644 --- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c +++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c @@ -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;
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: 87218f96c21a ("remoteproc: k3-dsp: Add support for C71x DSPs") Signed-off-by: YueHaibing <yuehaibing@huawei.com> --- drivers/remoteproc/ti_k3_dsp_remoteproc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)