Applied "spi: rockchip: potential NULL dereference on error" to the spi tree

Mark Brown broonie at
Wed May 4 06:56:56 PDT 2016

The patch

   spi: rockchip: potential NULL dereference on error

has been applied to the spi tree at


All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.


>From 5de7ed0c980c4bcfd8ea5c0b84a61b76df7d6c08 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <dan.carpenter at>
Date: Wed, 4 May 2016 09:25:46 +0300
Subject: [PATCH] spi: rockchip: potential NULL dereference on error

We were calling dma_release_channel(rs-> when "rs->"
is potentially NULL.  There is actually a call to that in the unwind
code at the bottom of the function so we can just re-arrange this a bit
and remove the call.  Also there is no need to set rs-> to
NULL on this error path.

Fixes: e4c0e06f949b ('spi: rockchip: fix probe deferral handling')
Signed-off-by: Dan Carpenter <dan.carpenter at>
Signed-off-by: Mark Brown <broonie at>
 drivers/spi/spi-rockchip.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 6c6c0013ec7a..cd89682065b9 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -744,10 +744,8 @@ static int rockchip_spi_probe(struct platform_device *pdev)
 	rs-> = dma_request_chan(rs->dev, "rx");
 	if (IS_ERR(rs-> {
 		if (PTR_ERR(rs-> == -EPROBE_DEFER) {
-			dma_release_channel(rs->;
-			rs-> = NULL;
 			ret = -EPROBE_DEFER;
-			goto err_get_fifo_len;
+			goto err_free_dma_tx;
 		dev_warn(rs->dev, "Failed to request RX DMA channel\n");
 		rs-> = NULL;
@@ -775,10 +773,11 @@ static int rockchip_spi_probe(struct platform_device *pdev)
-	if (rs->
-		dma_release_channel(rs->;
 	if (rs->
+	if (rs->
+		dma_release_channel(rs->;

More information about the Linux-rockchip mailing list