mtd: rawnand: cadence: fix unchecked dereference
Subsystems (3)
PATCH 1/1 mtd: rawnand: cadence: fix unchecked dereference
From: Niravkumar L Rabara <[email protected]>
Add NULL check before variable dereference to fix static checker warning.
Fixes d76d22b5096c ("mtd: rawnand: cadence: use dma_map_resource for sdma address")
Reported-by Dan Carpenter <[email protected]>
Signed-off-by Niravkumar L Rabara <[email protected]>
--- drivers/mtd/nand/raw/cadence-nand-controller.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/nand/raw/cadence-nand-controller.c +4 -2
@@ -2972,8 +2972,10 @@ static int cadence_nand_init(struct cdns_nand_ctrl *cdns_ctrl)static void cadence_nand_remove (struct cdns_nand_ctrl *cdns_ctrl) {cadence_nand_chips_cleanup (cdns_ctrl); -dma_unmap_resource (cdns_ctrl->dmac->device->dev, cdns_ctrl->io.iova_dma, - cdns_ctrl->io.size,DMA_BIDIRECTIONAL ,0 ); +if (cdns_ctrl->dmac) +dma_unmap_resource (cdns_ctrl->dmac->device->dev, + cdns_ctrl->io.iova_dma, cdns_ctrl->io.size, +DMA_BIDIRECTIONAL ,0 );cadence_nand_irq_cleanup (cdns_ctrl->irq, cdns_ctrl);kfree (cdns_ctrl->buf); dma_free_coherent(cdns_ctrl->dev, sizeof(struct cadence_nand_cdma_desc),
Signature · 1 line
2.25.1
Quoted 3 lines · On Sun, 16 Feb 2025 11:15:36 +0800, [email protected] wrote:
Add NULL check before variable dereference to fix static checker warning.
Applied to mtd/fixes, thanks!
[1/1] mtd: rawnand: cadence: fix unchecked dereference
commit: 60255f3704fde70ed3c4d62f919aa4b46f841f70
Patche(s) should be available on mtd/linux.git and will be part of the next PR (provided that no robot complains by then).
Kind regards,
Miquèl