All of lore.kernel.org
 help / color / mirror / Atom feed
* dmaengine: sprd: fix an NULL vs IS_ERR() bug
@ 2018-05-16  8:48 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-05-16  8:48 UTC (permalink / raw)
  To: Dan Williams, Baolin Wang
  Cc: Vinod Koul, Orson Zhai, Chunyan Zhang, dmaengine, kernel-janitors

We recently cleaned this code up but we need to update the error
handling as well.  The devm_ioremap_resource() returns error pointers on
error, never NULL.

Fixes: e7f063ae1a31 ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index e715d07aa632..36df3b096bbc 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -808,8 +808,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!sdev->glb_base)
-		return -ENOMEM;
+	if (IS_ERR(sdev->glb_base))
+		return PTR_ERR(sdev->glb_base);
 
 	dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
 	sdev->total_chns = chn_count;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] dmaengine: sprd: fix an NULL vs IS_ERR() bug
@ 2018-05-16  8:48 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2018-05-16  8:48 UTC (permalink / raw)
  To: Dan Williams, Baolin Wang
  Cc: Vinod Koul, Orson Zhai, Chunyan Zhang, dmaengine, kernel-janitors

We recently cleaned this code up but we need to update the error
handling as well.  The devm_ioremap_resource() returns error pointers on
error, never NULL.

Fixes: e7f063ae1a31 ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
index e715d07aa632..36df3b096bbc 100644
--- a/drivers/dma/sprd-dma.c
+++ b/drivers/dma/sprd-dma.c
@@ -808,8 +808,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!sdev->glb_base)
-		return -ENOMEM;
+	if (IS_ERR(sdev->glb_base))
+		return PTR_ERR(sdev->glb_base);
 
 	dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
 	sdev->total_chns = chn_count;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* dmaengine: sprd: fix an NULL vs IS_ERR() bug
  2018-05-16  8:48 ` [PATCH] " Dan Carpenter
@ 2018-05-16  8:56 ` Baolin Wang
  -1 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2018-05-16  8:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Dan Williams, Vinod Koul, Orson Zhai, Chunyan Zhang, dmaengine,
	kernel-janitors

Hi Dan,

On 16 May 2018 at 16:48, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We recently cleaned this code up but we need to update the error
> handling as well.  The devm_ioremap_resource() returns error pointers on
> error, never NULL.
>
> Fixes: e7f063ae1a31 ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>

>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index e715d07aa632..36df3b096bbc 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -808,8 +808,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
> -       if (!sdev->glb_base)
> -               return -ENOMEM;
> +       if (IS_ERR(sdev->glb_base))
> +               return PTR_ERR(sdev->glb_base);
>
>         dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
>         sdev->total_chns = chn_count;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: sprd: fix an NULL vs IS_ERR() bug
@ 2018-05-16  8:56 ` Baolin Wang
  0 siblings, 0 replies; 6+ messages in thread
From: Baolin Wang @ 2018-05-16  8:56 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Dan Williams, Vinod Koul, Orson Zhai, Chunyan Zhang, dmaengine,
	kernel-janitors

Hi Dan,

On 16 May 2018 at 16:48, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> We recently cleaned this code up but we need to update the error
> handling as well.  The devm_ioremap_resource() returns error pointers on
> error, never NULL.
>
> Fixes: e7f063ae1a31 ("dmaengine: sprd: Use devm_ioremap_resource() to map memory")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linaro.org>

>
> diff --git a/drivers/dma/sprd-dma.c b/drivers/dma/sprd-dma.c
> index e715d07aa632..36df3b096bbc 100644
> --- a/drivers/dma/sprd-dma.c
> +++ b/drivers/dma/sprd-dma.c
> @@ -808,8 +808,8 @@ static int sprd_dma_probe(struct platform_device *pdev)
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         sdev->glb_base = devm_ioremap_resource(&pdev->dev, res);
> -       if (!sdev->glb_base)
> -               return -ENOMEM;
> +       if (IS_ERR(sdev->glb_base))
> +               return PTR_ERR(sdev->glb_base);
>
>         dma_cap_set(DMA_MEMCPY, sdev->dma_dev.cap_mask);
>         sdev->total_chns = chn_count;



-- 
Baolin.wang
Best Regards

^ permalink raw reply	[flat|nested] 6+ messages in thread

* dmaengine: sprd: fix an NULL vs IS_ERR() bug
  2018-05-16  8:48 ` [PATCH] " Dan Carpenter
@ 2018-05-17  4:43 ` Vinod
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2018-05-17  4:31 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Dan Williams, Baolin Wang, Orson Zhai, Chunyan Zhang, dmaengine,
	kernel-janitors

On 16-05-18, 11:48, Dan Carpenter wrote:
> We recently cleaned this code up but we need to update the error
> handling as well.  The devm_ioremap_resource() returns error pointers on
> error, never NULL.

Applied, thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] dmaengine: sprd: fix an NULL vs IS_ERR() bug
@ 2018-05-17  4:43 ` Vinod
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod @ 2018-05-17  4:43 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Dan Williams, Baolin Wang, Orson Zhai, Chunyan Zhang, dmaengine,
	kernel-janitors

On 16-05-18, 11:48, Dan Carpenter wrote:
> We recently cleaned this code up but we need to update the error
> handling as well.  The devm_ioremap_resource() returns error pointers on
> error, never NULL.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-05-17  4:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16  8:56 dmaengine: sprd: fix an NULL vs IS_ERR() bug Baolin Wang
2018-05-16  8:56 ` [PATCH] " Baolin Wang
  -- strict thread matches above, loose matches on Subject: below --
2018-05-17  4:31 Vinod Koul
2018-05-17  4:43 ` [PATCH] " Vinod
2018-05-16  8:48 Dan Carpenter
2018-05-16  8:48 ` [PATCH] " Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.