lkml.org 
[lkml]   [2017]   [Dec]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mtd: nand: vf610: fix error handling in vf610_nfc_probe()
On Sat, 23 Dec 2017 00:43:14 +0300
Alexey Khoroshilov <khoroshilov@ispras.ru> wrote:

> vf610_nfc_probe() misses error handling of mtd_device_register().
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
> ---
> drivers/mtd/nand/vf610_nfc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
> index 8037d4b48a05..a4c181af74b3 100644
> --- a/drivers/mtd/nand/vf610_nfc.c
> +++ b/drivers/mtd/nand/vf610_nfc.c
> @@ -782,7 +782,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, mtd);
>
> /* Register device in MTD */
> - return mtd_device_register(mtd, NULL, 0);
> + err = mtd_device_register(mtd, NULL, 0);
> + if (err)
> + goto error;

Nope, you're not entirely fixing the leak: nand_scan_tail() has to be
undone with nand_cleanup().

> + return 0;
>
> error:
> of_node_put(nand_get_flash_node(chip));

\
 
 \ /
  Last update: 2017-12-22 22:57    [W:0.072 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site