Skip to content

Commit b3497ef

Browse files
thierryredingwsakernel
authored andcommitted
i2c: tegra: Fix failure during probe deferral cleanup
If the driver fails to obtain a DMA channel, it will initiate cleanup and try to release the DMA channel that couldn't be retrieved. This will cause a crash because the cleanup will try to dereference an ERR_PTR()- encoded error code. However, there's nothing to clean up at this point yet, so we can avoid this by simply resetting the DMA channel to NULL instead of storing the error code. Fixes: fcc8a89 ("i2c: tegra: Share same DMA channel for RX and TX") Signed-off-by: Thierry Reding <treding@nvidia.com> Tested-by: Akhil R <akhilrajeev@nvidia.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 69f035c commit b3497ef

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/i2c/busses/i2c-tegra.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
460460
i2c_dev->dma_chan = dma_request_chan(i2c_dev->dev, "tx");
461461
if (IS_ERR(i2c_dev->dma_chan)) {
462462
err = PTR_ERR(i2c_dev->dma_chan);
463+
i2c_dev->dma_chan = NULL;
463464
goto err_out;
464465
}
465466

0 commit comments

Comments
 (0)