瀏覽代碼

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>
Marek Behún 2 年之前
父節點
當前提交
0ef476e68e
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      board/CZ.NIC/turris_omnia/turris_omnia.c

+ 3 - 0
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))
 	if (!fixup_mtd_partitions(blob, node, mtd))
 		goto fail;
 		goto fail;
 
 
+	put_mtd_device(mtd);
 	return 0;
 	return 0;
 
 
 fail:
 fail:
 	printf("Failed fixing SPI NOR partitions!\n");
 	printf("Failed fixing SPI NOR partitions!\n");
+	if (!IS_ERR_OR_NULL(mtd))
+		put_mtd_device(mtd);
 	return 0;
 	return 0;
 }
 }
 #endif
 #endif