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

mtd: rawnand: cadence: fix error code in cadence_nand_init()

stable inclusion
from stable-v6.6.80
commit fcae111830a4c563491c4ffd3facac7d908f6219
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=fcae111830a4c563491c4ffd3facac7d908f6219



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

commit 2b9df00cded911e2ca2cfae5c45082166b24f8aa upstream.

Replace dma_request_channel() with dma_request_chan_by_mask() and use
helper functions to return proper error code instead of fixed -EBUSY.

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 fcae111830a4c563491c4ffd3facac7d908f6219)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 64358e78
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -2909,11 +2909,10 @@ static int cadence_nand_init(struct cdns_nand_ctrl *cdns_ctrl)
	dma_cap_set(DMA_MEMCPY, mask);

	if (cdns_ctrl->caps1->has_dma) {
		cdns_ctrl->dmac = dma_request_channel(mask, NULL, NULL);
		if (!cdns_ctrl->dmac) {
			dev_err(cdns_ctrl->dev,
				"Unable to get a DMA channel\n");
			ret = -EBUSY;
		cdns_ctrl->dmac = dma_request_chan_by_mask(&mask);
		if (IS_ERR(cdns_ctrl->dmac)) {
			ret = dev_err_probe(cdns_ctrl->dev, PTR_ERR(cdns_ctrl->dmac),
					    "%d: Failed to get a DMA channel\n", ret);
			goto disable_irq;
		}
	}