mtd: rawnand: tegra: add missing check for platform_get_irq()
authorYi Yang <yiyang13@huawei.com>
Mon, 21 Aug 2023 08:40:46 +0000 (16:40 +0800)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Mon, 11 Sep 2023 15:49:55 +0000 (17:49 +0200)
Add the missing check for platform_get_irq() and return error code
if it fails.

Fixes: d7d9f8ec77fe ("mtd: rawnand: add NVIDIA Tegra NAND Flash controller driver")
Signed-off-by: Yi Yang <yiyang13@huawei.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230821084046.217025-1-yiyang13@huawei.com
drivers/mtd/nand/raw/tegra_nand.c

index eb0b9d16e8dae98e856cc1737da85c82f850f1d4..a553e3ac8ff41d063fbb1f7bcb27345c11b7fb35 100644 (file)
@@ -1197,6 +1197,10 @@ static int tegra_nand_probe(struct platform_device *pdev)
        init_completion(&ctrl->dma_complete);
 
        ctrl->irq = platform_get_irq(pdev, 0);
+       if (ctrl->irq < 0) {
+               err = ctrl->irq;
+               goto err_put_pm;
+       }
        err = devm_request_irq(&pdev->dev, ctrl->irq, tegra_nand_irq, 0,
                               dev_name(&pdev->dev), ctrl);
        if (err) {