i2c: tegra: Fix failure during probe deferral cleanup
authorThierry Reding <treding@nvidia.com>
Fri, 7 Jul 2023 13:26:19 +0000 (15:26 +0200)
committerWolfram Sang <wsa@kernel.org>
Mon, 14 Aug 2023 13:33:23 +0000 (15:33 +0200)
commitb3497ef404dc3a8a7b8438a8950f46c4cd0e6ccf
treefd41b5bef70598a3e544b87448b641a61e097b12
parent69f035c480d76f12bf061148ccfd578e1099e5fc
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: fcc8a89a1c83 ("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>
drivers/i2c/busses/i2c-tegra.c