From: Dan Carpenter Date: Fri, 6 Feb 2026 13:38:54 +0000 (+0300) Subject: mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6c7860aa28b81b7e909b8d2072ed76fa22db6eda;p=thirdparty%2Flinux.git mtd: spi-nor: hisi-sfc: fix refcounting bug in hisi_spi_nor_register_all() 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 Reviewed-by: Pratyush Yadav Signed-off-by: Miquel Raynal --- diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c index 54c49a8423a28..6897ced2d57b9 100644 --- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c +++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c @@ -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; } }