diff mbox

dmaengine: stm32-dmamux: Fix a NULL vs IS_ERR() check in probe

Message ID 20171003105450.nll2ogf44l3eq4ge@mwanda (mailing list archive)
State Accepted
Headers show

Commit Message

Dan Carpenter Oct. 3, 2017, 10:54 a.m. UTC
devm_ioremap_resource() doesn't return NULL, it returns error pointers.

Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
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

Comments

Pierre Yves MORDRET Oct. 3, 2017, 12:17 p.m. UTC | #1
On 10/03/2017 12:54 PM, Dan Carpenter wrote:
> devm_ioremap_resource() doesn't return NULL, it returns error pointers.
> 
> Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
> index 22812e7a953b..d5db0f6e1ff8 100644
> --- a/drivers/dma/stm32-dmamux.c
> +++ b/drivers/dma/stm32-dmamux.c
> @@ -257,8 +257,8 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  
>  	iomem = devm_ioremap_resource(&pdev->dev, res);
> -	if (!iomem)
> -		return -ENOMEM;
> +	if (IS_ERR(iomem))
> +		return PTR_ERR(iomem);
>  
>  	spin_lock_init(&stm32_dmamux->lock);
>  
> 

Acked-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.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
Vinod Koul Oct. 8, 2017, 10:47 a.m. UTC | #2
On Tue, Oct 03, 2017 at 01:54:50PM +0300, Dan Carpenter wrote:
> devm_ioremap_resource() doesn't return NULL, it returns error pointers.

Applied, thanks
diff mbox

Patch

diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
index 22812e7a953b..d5db0f6e1ff8 100644
--- a/drivers/dma/stm32-dmamux.c
+++ b/drivers/dma/stm32-dmamux.c
@@ -257,8 +257,8 @@  static int stm32_dmamux_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	iomem = devm_ioremap_resource(&pdev->dev, res);
-	if (!iomem)
-		return -ENOMEM;
+	if (IS_ERR(iomem))
+		return PTR_ERR(iomem);
 
 	spin_lock_init(&stm32_dmamux->lock);