]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 6 Feb 2026 13:38:54 +0000 (16:38 +0300)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 6 Feb 2026 14:22:42 +0000 (15:22 +0100)
This was converted to a _scoped() loop but this of_node_put() was
accidentally left behind which is a double free.

Fixes: aa8cb72c2018 ("mtd: spi-nor: hisi-sfc: Simplify with scoped for each OF child loop")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
drivers/mtd/spi-nor/controllers/hisi-sfc.c

index 54c49a8423a281782607193a51309c2f7bfb604a..6897ced2d57b9138e81d431ad79b5d14108daf32 100644 (file)
@@ -403,7 +403,6 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
 
                if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
                        dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
-                       of_node_put(np);
                        break;
                }
        }