From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
There is no need to check the entries in priv->clks[] array before passing
it to clk_disable_unprepare() as the clk_disable_unprepare() already
check if it receives a NULL or error pointer as argument. Remove this
check. This makes the code simpler.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/usb/host/ehci-platform.c | 3 +--
drivers/usb/host/ohci-platform.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index bcd1c9073515..57d5a7ddac5f 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -112,8 +112,7 @@ static void ehci_platform_power_off(struct platform_device *dev)
int clk;
for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--)
- if (priv->clks[clk])
- clk_disable_unprepare(priv->clks[clk]);
+ clk_disable_unprepare(priv->clks[clk]);
}
static struct hc_driver __read_mostly ehci_platform_hc_driver;
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index f47ae12cde6a..af26f1449bc2 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -69,8 +69,7 @@ static void ohci_platform_power_off(struct platform_device *dev)
int clk;
for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--)
- if (priv->clks[clk])
- clk_disable_unprepare(priv->clks[clk]);
+ clk_disable_unprepare(priv->clks[clk]);
}
static struct hc_driver __read_mostly ohci_platform_hc_driver;
--
2.43.0
On Thu, Nov 06, 2025 at 04:36:22PM +0200, Claudiu wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > There is no need to check the entries in priv->clks[] array before passing > it to clk_disable_unprepare() as the clk_disable_unprepare() already > check if it receives a NULL or error pointer as argument. Remove this > check. This makes the code simpler. > > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- Acked-by: Alan Stern <stern@rowland.harvard.edu> > drivers/usb/host/ehci-platform.c | 3 +-- > drivers/usb/host/ohci-platform.c | 3 +-- > 2 files changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index bcd1c9073515..57d5a7ddac5f 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -112,8 +112,7 @@ static void ehci_platform_power_off(struct platform_device *dev) > int clk; > > for (clk = EHCI_MAX_CLKS - 1; clk >= 0; clk--) > - if (priv->clks[clk]) > - clk_disable_unprepare(priv->clks[clk]); > + clk_disable_unprepare(priv->clks[clk]); > } > > static struct hc_driver __read_mostly ehci_platform_hc_driver; > diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c > index f47ae12cde6a..af26f1449bc2 100644 > --- a/drivers/usb/host/ohci-platform.c > +++ b/drivers/usb/host/ohci-platform.c > @@ -69,8 +69,7 @@ static void ohci_platform_power_off(struct platform_device *dev) > int clk; > > for (clk = OHCI_MAX_CLKS - 1; clk >= 0; clk--) > - if (priv->clks[clk]) > - clk_disable_unprepare(priv->clks[clk]); > + clk_disable_unprepare(priv->clks[clk]); > } > > static struct hc_driver __read_mostly ohci_platform_hc_driver; > -- > 2.43.0 >
Hi Claudiu,
Thanks for your patch!
On Thu, 6 Nov 2025 at 15:36, Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> There is no need to check the entries in priv->clks[] array before passing
> it to clk_disable_unprepare() as the clk_disable_unprepare() already
them ... as clk_disable_unprepare
> check if it receives a NULL or error pointer as argument. Remove this
checks
> check. This makes the code simpler.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
© 2016 - 2026 Red Hat, Inc.