diff options
author | Pan Bian <bianpan2016@163.com> | 2021-01-21 01:18:47 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-04 09:39:55 +0100 |
commit | 9e0a14124caaf194f63705454400891a5c1133d7 (patch) | |
tree | 460df58a97e6707eb3b4329ed36c45c9bc1e3583 /drivers/mtd | |
parent | 20b5124bc8c096bd934bfc8cfe1f7655d688fa94 (diff) | |
download | linux-stable-9e0a14124caaf194f63705454400891a5c1133d7.tar.gz linux-stable-9e0a14124caaf194f63705454400891a5c1133d7.tar.bz2 linux-stable-9e0a14124caaf194f63705454400891a5c1133d7.zip |
mtd: spi-nor: hisi-sfc: Put child node np on error path
commit fe6653460ee7a7dbe0cd5fd322992af862ce5ab0 upstream.
Put the child node np when it fails to get or register device.
Fixes: e523f11141bd ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi-nor/hisi-sfc.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/mtd/spi-nor/hisi-sfc.c b/drivers/mtd/spi-nor/hisi-sfc.c index dea7b0c4b339..184ba5069ac5 100644 --- a/drivers/mtd/spi-nor/hisi-sfc.c +++ b/drivers/mtd/spi-nor/hisi-sfc.c @@ -408,8 +408,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"); |