2020-08-06 07:27:11

by Evgeny Novikov

[permalink] [raw]
Subject: [PATCH] mtd: rawnand: vf610: disable clk on error handling path in probe

vf610_nfc_probe() does not invoke clk_disable_unprepare() on one error
handling path. The patch fixes that.

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 6f0ce4dfc5a3 ("mtd: rawnand: vf610: Avoid a potential NULL pointer dereference")
Signed-off-by: Evgeny Novikov <[email protected]>
---
drivers/mtd/nand/raw/vf610_nfc.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index 7248c5901183..fcca45e2abe2 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -852,8 +852,10 @@ static int vf610_nfc_probe(struct platform_device *pdev)
}

of_id = of_match_device(vf610_nfc_dt_ids, &pdev->dev);
- if (!of_id)
- return -ENODEV;
+ if (!of_id) {
+ err = -ENODEV;
+ goto err_disable_clk;
+ }

nfc->variant = (enum vf610_nfc_variant)of_id->data;

--
2.26.2


2020-09-07 07:23:07

by Miquel Raynal

[permalink] [raw]
Subject: Re: [PATCH] mtd: rawnand: vf610: disable clk on error handling path in probe

On Thu, 2020-08-06 at 07:26:34 UTC, Evgeny Novikov wrote:
> vf610_nfc_probe() does not invoke clk_disable_unprepare() on one error
> handling path. The patch fixes that.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Fixes: 6f0ce4dfc5a3 ("mtd: rawnand: vf610: Avoid a potential NULL pointer dereference")
> Signed-off-by: Evgeny Novikov <[email protected]>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel