diff mbox

spi: s3c64xx: potential oops on probe error

Message ID 20170113074253.GA30524@mwanda (mailing list archive)
State Accepted
Commit 72bc7ae0633e2b580217d254114ac6650380b7f6
Headers show

Commit Message

Dan Carpenter Jan. 13, 2017, 7:42 a.m. UTC
We accidentally mixed up freeing the rx and tx channels which would a
leak and an oops.

Fixes: 3d63a47a380a ("spi: s3c64xx: Don't request/release DMA channels for each SPI transfer")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Marek Szyprowski Jan. 13, 2017, 8:52 a.m. UTC | #1
Hi Dan,


On 2017-01-13 08:42, Dan Carpenter wrote:
> We accidentally mixed up freeing the rx and tx channels which would a
> leak and an oops.
>
> Fixes: 3d63a47a380a ("spi: s3c64xx: Don't request/release DMA channels for each SPI transfer")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Right, my fault. Thanks for the fix!
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 849ee82..b8cd356 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -1147,7 +1147,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>   		if (IS_ERR(sdd->tx_dma.ch)) {
>   			dev_err(&pdev->dev, "Failed to get TX DMA channel\n");
>   			ret = PTR_ERR(sdd->tx_dma.ch);
> -			goto err_release_tx_dma;
> +			goto err_release_rx_dma;
>   		}
>   	}
>   
> @@ -1197,10 +1197,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>   	pm_runtime_set_suspended(&pdev->dev);
>   
>   	if (!is_polling(sdd))
> -		dma_release_channel(sdd->rx_dma.ch);
> -err_release_tx_dma:
> -	if (!is_polling(sdd))
>   		dma_release_channel(sdd->tx_dma.ch);
> +err_release_rx_dma:
> +	if (!is_polling(sdd))
> +		dma_release_channel(sdd->rx_dma.ch);
>   err_disable_io_clk:
>   	clk_disable_unprepare(sdd->ioclk);
>   err_disable_src_clk:
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

Best regards
Andi Shyti Jan. 13, 2017, 11:12 a.m. UTC | #2
On Fri, Jan 13, 2017 at 10:42:53AM +0300, Dan Carpenter wrote:
> We accidentally mixed up freeing the rx and tx channels which would a
> leak and an oops.
> 
> Fixes: 3d63a47a380a ("spi: s3c64xx: Don't request/release DMA channels for each SPI transfer")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, Dan.

Acked-by: Andi Shyti <andi.shyti@samsung.com>

Andi

> 
> diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
> index 849ee82..b8cd356 100644
> --- a/drivers/spi/spi-s3c64xx.c
> +++ b/drivers/spi/spi-s3c64xx.c
> @@ -1147,7 +1147,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>  		if (IS_ERR(sdd->tx_dma.ch)) {
>  			dev_err(&pdev->dev, "Failed to get TX DMA channel\n");
>  			ret = PTR_ERR(sdd->tx_dma.ch);
> -			goto err_release_tx_dma;
> +			goto err_release_rx_dma;
>  		}
>  	}
>  
> @@ -1197,10 +1197,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
>  	pm_runtime_set_suspended(&pdev->dev);
>  
>  	if (!is_polling(sdd))
> -		dma_release_channel(sdd->rx_dma.ch);
> -err_release_tx_dma:
> -	if (!is_polling(sdd))
>  		dma_release_channel(sdd->tx_dma.ch);
> +err_release_rx_dma:
> +	if (!is_polling(sdd))
> +		dma_release_channel(sdd->rx_dma.ch);
>  err_disable_io_clk:
>  	clk_disable_unprepare(sdd->ioclk);
>  err_disable_src_clk:
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 849ee82..b8cd356 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1147,7 +1147,7 @@  static int s3c64xx_spi_probe(struct platform_device *pdev)
 		if (IS_ERR(sdd->tx_dma.ch)) {
 			dev_err(&pdev->dev, "Failed to get TX DMA channel\n");
 			ret = PTR_ERR(sdd->tx_dma.ch);
-			goto err_release_tx_dma;
+			goto err_release_rx_dma;
 		}
 	}
 
@@ -1197,10 +1197,10 @@  static int s3c64xx_spi_probe(struct platform_device *pdev)
 	pm_runtime_set_suspended(&pdev->dev);
 
 	if (!is_polling(sdd))
-		dma_release_channel(sdd->rx_dma.ch);
-err_release_tx_dma:
-	if (!is_polling(sdd))
 		dma_release_channel(sdd->tx_dma.ch);
+err_release_rx_dma:
+	if (!is_polling(sdd))
+		dma_release_channel(sdd->rx_dma.ch);
 err_disable_io_clk:
 	clk_disable_unprepare(sdd->ioclk);
 err_disable_src_clk: