Commit f9e64d61 authored by Daniel Mack's avatar Daniel Mack Committed by Miquel Raynal

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: default avatarDaniel Mack <daniel@zonque.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent 7734a275
...@@ -2773,17 +2773,19 @@ static int marvell_nfc_probe(struct platform_device *pdev) ...@@ -2773,17 +2773,19 @@ static int marvell_nfc_probe(struct platform_device *pdev)
return ret; return ret;
nfc->reg_clk = devm_clk_get(&pdev->dev, "reg"); nfc->reg_clk = devm_clk_get(&pdev->dev, "reg");
if (IS_ERR(nfc->reg_clk)) {
if (PTR_ERR(nfc->reg_clk) != -ENOENT) { 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 {
ret = PTR_ERR(nfc->reg_clk); ret = PTR_ERR(nfc->reg_clk);
goto unprepare_core_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_disable_int(nfc, NDCR_ALL_INT);
marvell_nfc_clear_int(nfc, NDCR_ALL_INT); marvell_nfc_clear_int(nfc, NDCR_ALL_INT);
ret = devm_request_irq(dev, irq, marvell_nfc_isr, ret = devm_request_irq(dev, irq, marvell_nfc_isr,
...@@ -2864,11 +2866,9 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev) ...@@ -2864,11 +2866,9 @@ static int __maybe_unused marvell_nfc_resume(struct device *dev)
if (ret < 0) if (ret < 0)
return ret; return ret;
if (!IS_ERR(nfc->reg_clk)) {
ret = clk_prepare_enable(nfc->reg_clk); ret = clk_prepare_enable(nfc->reg_clk);
if (ret < 0) if (ret < 0)
return ret; return ret;
}
/* /*
* Reset nfc->selected_chip so the next command will cause the timing * Reset nfc->selected_chip so the next command will cause the timing
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment