* [PATCH] mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed
@ 2022-05-12 18:45 Phil Edworthy
2022-05-16 16:44 ` Miquel Raynal
0 siblings, 1 reply; 2+ messages in thread
From: Phil Edworthy @ 2022-05-12 18:45 UTC (permalink / raw)
To: Miquel Raynal, Vignesh Raghavendra, Heiko Stuebner
Cc: Phil Edworthy, Richard Weinberger, Yihao Han, linux-mtd,
linux-arm-kernel, linux-rockchip
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>
---
Note: this has not been tested at all
---
drivers/mtd/nand/raw/rockchip-nand-controller.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
index cbaa4f1c83da..f133985cc053 100644
--- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
+++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
@@ -911,8 +911,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc)
ret = clk_prepare_enable(nfc->ahb_clk);
if (ret) {
dev_err(dev, "failed to enable ahb clk\n");
- if (!IS_ERR(nfc->nfc_clk))
- clk_disable_unprepare(nfc->nfc_clk);
+ clk_disable_unprepare(nfc->nfc_clk);
return ret;
}
@@ -921,8 +920,7 @@ static int rk_nfc_enable_clks(struct device *dev, struct rk_nfc *nfc)
static void rk_nfc_disable_clks(struct rk_nfc *nfc)
{
- if (!IS_ERR(nfc->nfc_clk))
- clk_disable_unprepare(nfc->nfc_clk);
+ clk_disable_unprepare(nfc->nfc_clk);
clk_disable_unprepare(nfc->ahb_clk);
}
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed
2022-05-12 18:45 [PATCH] mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed Phil Edworthy
@ 2022-05-16 16:44 ` Miquel Raynal
0 siblings, 0 replies; 2+ messages in thread
From: Miquel Raynal @ 2022-05-16 16:44 UTC (permalink / raw)
To: Phil Edworthy
Cc: Vignesh Raghavendra, Heiko Stuebner, Richard Weinberger,
Yihao Han, linux-mtd, linux-arm-kernel, linux-rockchip
Hi Phil,
phil.edworthy@renesas.com wrote on Thu, 12 May 2022 19:45:58 +0100:
> 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>
Both patches have been applied to nand/next.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-16 16:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 18:45 [PATCH] mtd: rawnand: rockchip: Check before clk_disable_unprepare() not needed Phil Edworthy
2022-05-16 16:44 ` Miquel Raynal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).