summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Behún <marek.behun@nic.cz>2021-09-25 03:49:18 +0300
committerStefan Roese <sr@denx.de>2021-09-27 08:41:45 +0300
commit0ef476e68ef6391c2358894b5e6ba51083718883 (patch)
treeac8dd42b914aa465a76727c35d4e8600d7eef2ab
parent8284d6f838684cfa6e3303a447deb38027c5d7f0 (diff)
downloadu-boot-0ef476e68ef6391c2358894b5e6ba51083718883.tar.xz
arm: mvebu: turris_omnia: fix leaked mtd device
After getting MTD device via get_mtd_device_nm(), we need to put it with put_mtd_device(), otherwise we get Removing MTD device #0 (mx25l6405d) with use count 1 before booting kernel. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Pali Rohár <pali@kernel.org> Tested-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index bac78af04e..a48e1f5c30 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -647,10 +647,13 @@ int ft_board_setup(void *blob, struct bd_info *bd)
if (!fixup_mtd_partitions(blob, node, mtd))
goto fail;
+ put_mtd_device(mtd);
return 0;
fail:
printf("Failed fixing SPI NOR partitions!\n");
+ if (!IS_ERR_OR_NULL(mtd))
+ put_mtd_device(mtd);
return 0;
}
#endif