Commit 5ca8de78 authored by Niravkumar L Rabara's avatar Niravkumar L Rabara Committed by Wentao Guan
Browse files

mtd: rawnand: cadence: fix incorrect device in dma_unmap_single

stable inclusion
from stable-v6.6.80
commit 8380ebc6f91b5905e31502bbf4b7ae60168287f7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBXANC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=8380ebc6f91b5905e31502bbf4b7ae60168287f7



--------------------------------

commit f37d135b42cb484bdecee93f56b9f483214ede78 upstream.

dma_map_single is using physical/bus device (DMA) but dma_unmap_single
is using framework device(NAND controller), which is incorrect.
Fixed dma_unmap_single to use correct physical/bus device.

Fixes: ec4ba01e ("mtd: rawnand: Add new Cadence NAND driver to MTD subsystem")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarNiravkumar L Rabara <niravkumar.l.rabara@intel.com>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 8380ebc6f91b5905e31502bbf4b7ae60168287f7)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 87ad5025
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1866,12 +1866,12 @@ static int cadence_nand_slave_dma_transfer(struct cdns_nand_ctrl *cdns_ctrl,
	dma_async_issue_pending(cdns_ctrl->dmac);
	wait_for_completion(&finished);

	dma_unmap_single(cdns_ctrl->dev, buf_dma, len, dir);
	dma_unmap_single(dma_dev->dev, buf_dma, len, dir);

	return 0;

err_unmap:
	dma_unmap_single(cdns_ctrl->dev, buf_dma, len, dir);
	dma_unmap_single(dma_dev->dev, buf_dma, len, dir);

err:
	dev_dbg(cdns_ctrl->dev, "Fall back to CPU I/O\n");