Skip to content

Commit 6879854

Browse files
Phil Edworthymiquelraynal
authored andcommitted
mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed
All code in clk_disable_unprepare() already checks the clk ptr using IS_ERR_OR_NULL so there is no need to check it again before calling it. A lot of other drivers already rely on this behaviour, so it's safe to do so here. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20220512184558.45966-1-phil.edworthy@renesas.com
1 parent 66d7a40 commit 6879854

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/mtd/nand/raw/rockchip-nand-controller.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc)
911911
ret = clk_prepare_enable(nfc->ahb_clk);
912912
if (ret) {
913913
dev_err(dev, "failed to enable ahb clk\n");
914-
if (!IS_ERR(nfc->nfc_clk))
915-
clk_disable_unprepare(nfc->nfc_clk);
914+
clk_disable_unprepare(nfc->nfc_clk);
916915
return ret;
917916
}
918917

@@ -921,8 +920,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc)
921920

922921
static void rk_nfc_disable_clks(struct rk_nfc *nfc)
923922
{
924-
if (!IS_ERR(nfc->nfc_clk))
925-
clk_disable_unprepare(nfc->nfc_clk);
923+
clk_disable_unprepare(nfc->nfc_clk);
926924
clk_disable_unprepare(nfc->ahb_clk);
927925
}
928926

0 commit comments

Comments
 (0)