Message ID | 20220610074525.69453-1-hanyihao@vivo.com |
---|---|
State | New |
Headers | show |
Series | usb: phy: tahvo: Check before clk_disable() not needed | expand |
On Fri, Jun 10, 2022 at 12:45:25AM -0700, Yihao Han wrote: > clk_disable() already checks the clk ptr using IS_ERR_OR_NULL(clk) It does? Are you sure? It will check for NULL, that's it. > so there is no need to check it again before calling it. This will break on some platforms, please always test your patches before sending them out. thanks, greg k-h
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c index f2d2cc586c5b..9cecc5444515 100644 --- a/drivers/usb/phy/phy-tahvo.c +++ b/drivers/usb/phy/phy-tahvo.c @@ -406,8 +406,7 @@ static int tahvo_usb_probe(struct platform_device *pdev) err_remove_phy: usb_remove_phy(&tu->phy); err_disable_clk: - if (!IS_ERR(tu->ick)) - clk_disable(tu->ick); + clk_disable(tu->ick); return ret; } @@ -418,8 +417,7 @@ static int tahvo_usb_remove(struct platform_device *pdev) free_irq(tu->irq, tu); usb_remove_phy(&tu->phy); - if (!IS_ERR(tu->ick)) - clk_disable(tu->ick); + clk_disable(tu->ick); return 0; }
clk_disable() already checks the clk ptr using IS_ERR_OR_NULL(clk) so there is no need to check it again before calling it. Signed-off-by: Yihao Han <hanyihao@vivo.com> --- drivers/usb/phy/phy-tahvo.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)