[PATCH] mtd: rawnand: omap2: fix device leak on probe failure
Markus Elfring
Markus.Elfring at web.de
Tue Sep 23 10:05:19 PDT 2025
…
> +++ b/drivers/mtd/nand/raw/omap2.c
…
> @@ -2054,7 +2054,8 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
> break;
> default:
> dev_err(dev, "Invalid or unsupported ECC scheme\n");
> - return -EINVAL;
> + err = -EINVAL;
> + goto err_put_elm_dev;
> }
>
> if (elm_bch_strength >= 0) {
…
> @@ -2083,10 +2084,24 @@ static int omap_nand_attach_chip(struct nand_chip *chip)
> dev_err(dev,
> "Not enough OOB bytes: required = %d, available=%d\n",
> min_oobbytes, mtd->oobsize);
> - return -EINVAL;
> + err = -EINVAL;
> + goto err_put_elm_dev;
> }
…
May such an error code assignment be moved behind an additional label?
Regards,
Markus
More information about the linux-mtd
mailing list