Skip to content

Commit fe66534

Browse files
SinkFinderambarus
authored andcommitted
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. Fixes: e523f11 ("mtd: spi-nor: add hisilicon spi-nor flash controller driver") Cc: stable@vger.kernel.org Signed-off-by: Pan Bian <bianpan2016@163.com> [ta: Add Fixes tag and Cc stable] Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Link: https://lore.kernel.org/r/20210121091847.85362-1-bianpan2016@163.com
1 parent d580246 commit fe66534

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/mtd/spi-nor/controllers/hisi-sfc.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,10 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
399399

400400
for_each_available_child_of_node(dev->of_node, np) {
401401
ret = hisi_spi_nor_register(np, host);
402-
if (ret)
402+
if (ret) {
403+
of_node_put(np);
403404
goto fail;
405+
}
404406

405407
if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
406408
dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");

0 commit comments

Comments
 (0)