[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210121091847.85362-1-bianpan2016@163.com>
Date: Thu, 21 Jan 2021 01:18:47 -0800
From: Pan Bian <bianpan2016@....com>
To: Tudor Ambarus <tudor.ambarus@...rochip.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Vignesh Raghavendra <vigneshr@...com>,
Boris Brezillon <bbrezillon@...nel.org>,
Lee Jones <lee.jones@...aro.org>,
Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
Cc: linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Pan Bian <bianpan2016@....com>
Subject: [PATCH] mtd: spi-nor: hisi-sfc: Put child node np on error path
Put the child node np when it fails to get or register device.
Signed-off-by: Pan Bian <bianpan2016@....com>
---
drivers/mtd/spi-nor/controllers/hisi-sfc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/controllers/hisi-sfc.c b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
index 7c26f8f565cb..47fbf1d1e557 100644
--- a/drivers/mtd/spi-nor/controllers/hisi-sfc.c
+++ b/drivers/mtd/spi-nor/controllers/hisi-sfc.c
@@ -399,8 +399,10 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
for_each_available_child_of_node(dev->of_node, np) {
ret = hisi_spi_nor_register(np, host);
- if (ret)
+ if (ret) {
+ of_node_put(np);
goto fail;
+ }
if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
--
2.17.1
Powered by blists - more mailing lists