Skip to content

Commit 7ae2227

Browse files
gaurijhangianiambarus
authored andcommitted
mtd: spi-nor: hisi-sfc: Add of_node_put() before break
Each iteration of for_each_available_child_of_node puts the previous node, but in the case of a break from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the break. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
1 parent 6597f0b commit 7ae2227

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ static int hisi_spi_nor_register_all(struct hifmc_host *host)
401401

402402
if (host->num_chip == HIFMC_MAX_CHIP_NUM) {
403403
dev_warn(dev, "Flash device number exceeds the maximum chipselect number\n");
404+
of_node_put(np);
404405
break;
405406
}
406407
}

0 commit comments

Comments
 (0)