diff options
author | Daniel Mack <daniel@zonque.org> | 2018-07-08 03:10:08 +0300 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-07-18 11:10:15 +0300 |
commit | f9e64d61042575960ce868fa974d9dbe4937c59a (patch) | |
tree | fa4e0e940ee2d14798844327768240f1d9f248ff /drivers/mtd/nand/raw/marvell_nand.c | |
parent | 7734a275a7eebf11878a923dc102908eff0f0657 (diff) | |
download | linux-f9e64d61042575960ce868fa974d9dbe4937c59a.tar.xz |
mtd: rawnand: marvell: set reg_clk to NULL if it can't be obtained
Don't keep an error-pointer around in the private struct. If this optional
clock can't be obtained, simply set the pointer to NULL instead so we can
use clk_prepare_enable() on it without further checks,
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Diffstat (limited to 'drivers/mtd/nand/raw/marvell_nand.c')
-rw-r--r-- | drivers/mtd/nand/raw/marvell_nand.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/mtd/nand/raw/marvell_nand.c b/drivers/mtd/nand/raw/marvell_nand.c index 638a0c8b44b8..80a074cccb82 100644 --- a/drivers/mtd/nand/raw/marvell_nand.c +++ b/drivers/mtd/nand/raw/marvell_nand.c @@ -2773,17 +2773,19 @@ static int marvell_nfc_probe(struct platform_device *pdev) return ret; nfc->reg_clk = devm_clk_get(&pdev->dev, "reg"); - if (PTR_ERR(nfc->reg_clk) != -ENOENT) { - if (!IS_ERR(nfc->reg_clk)) { - ret = clk_prepare_enable(nfc->reg_clk); - if (ret) - goto unprepare_core_clk; - } else { + if (IS_ERR(nfc->reg_clk)) { + if (PTR_ERR(nfc->reg_clk) != -ENOENT) { ret = PTR_ERR(nfc->reg_clk); goto unprepare_core_clk; } + + nfc->reg_clk = NULL; } + ret = clk_prepare_enable(nfc->reg_clk); + if (ret) + goto unprepare_core_clk; + marvell_nfc_disable_int(nfc, NDCR_ALL_INT); marvell_nfc_clear_int(nfc, NDCR_ALL_INT); ret = devm_request_irq(dev, irq, marvell_nfc_isr, @@ -2864,11 +2866,9 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev) if (ret < 0) return ret; - if (!IS_ERR(nfc->reg_clk)) { - ret = clk_prepare_enable(nfc->reg_clk); - if (ret < 0) - return ret; - } + ret = clk_prepare_enable(nfc->reg_clk); + if (ret < 0) + return ret; /* * Reset nfc->selected_chip so the next command will cause the timing |