]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
arm: mvebu: turris_omnia: fix leaked mtd device
authorMarek Behún <marek.behun@nic.cz>
Sat, 25 Sep 2021 00:49:18 +0000 (02:49 +0200)
committerRamon Fried <rfried.dev@gmail.com>
Tue, 28 Sep 2021 15:50:55 +0000 (18:50 +0300)
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>
board/CZ.NIC/turris_omnia/turris_omnia.c

index bac78af04e068879d5919292e4ce3bf68b0bc565..a48e1f5c305d3bfef69d00f64519ed416a732524 100644 (file)
@@ -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