* [PATCH] usb: dwc2: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare
@ 2020-12-04 8:36 Xu Wang
2020-12-08 7:29 ` Artur Petrosyan
0 siblings, 1 reply; 3+ messages in thread
From: Xu Wang @ 2020-12-04 8:36 UTC (permalink / raw)
To: hminas, gregkh, p.zabel, lgirdwood, broonie; +Cc: linux-usb, linux-kernel
Because clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter, so the additional checks are unnecessary, just
remove them.
Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
drivers/usb/dwc2/platform.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 5f18acac7406..ba2b491c7f82 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -143,11 +143,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
if (ret)
return ret;
- if (hsotg->clk) {
- ret = clk_prepare_enable(hsotg->clk);
- if (ret)
- return ret;
- }
+ ret = clk_prepare_enable(hsotg->clk);
+ if (ret)
+ return ret;
if (hsotg->uphy) {
ret = usb_phy_init(hsotg->uphy);
@@ -195,8 +193,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
if (ret)
return ret;
- if (hsotg->clk)
- clk_disable_unprepare(hsotg->clk);
+ clk_disable_unprepare(hsotg->clk);
return 0;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc2: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare
2020-12-04 8:36 [PATCH] usb: dwc2: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare Xu Wang
@ 2020-12-08 7:29 ` Artur Petrosyan
2020-12-08 7:33 ` Minas Harutyunyan
0 siblings, 1 reply; 3+ messages in thread
From: Artur Petrosyan @ 2020-12-08 7:29 UTC (permalink / raw)
To: Xu Wang, Minas Harutyunyan, gregkh, p.zabel, lgirdwood, broonie,
Felipe Balbi
Cc: linux-usb, linux-kernel
On 12/4/2020 12:36, Xu Wang wrote:
> Because clk_prepare_enable() and clk_disable_unprepare() already checked
> NULL clock parameter, so the additional checks are unnecessary, just
> remove them.
>
> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Reviewed-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
> ---
> drivers/usb/dwc2/platform.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index 5f18acac7406..ba2b491c7f82 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -143,11 +143,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
> if (ret)
> return ret;
>
> - if (hsotg->clk) {
> - ret = clk_prepare_enable(hsotg->clk);
> - if (ret)
> - return ret;
> - }
> + ret = clk_prepare_enable(hsotg->clk);
> + if (ret)
> + return ret;
>
> if (hsotg->uphy) {
> ret = usb_phy_init(hsotg->uphy);
> @@ -195,8 +193,7 @@ static int __dwc2_lowlevel_hw_disable(struct dwc2_hsotg *hsotg)
> if (ret)
> return ret;
>
> - if (hsotg->clk)
> - clk_disable_unprepare(hsotg->clk);
> + clk_disable_unprepare(hsotg->clk);
>
> return 0;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: dwc2: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare
2020-12-08 7:29 ` Artur Petrosyan
@ 2020-12-08 7:33 ` Minas Harutyunyan
0 siblings, 0 replies; 3+ messages in thread
From: Minas Harutyunyan @ 2020-12-08 7:33 UTC (permalink / raw)
To: Artur Petrosyan, Xu Wang, gregkh, p.zabel, lgirdwood, broonie,
Felipe Balbi
Cc: linux-usb, linux-kernel
On 12/8/2020 11:29 AM, Artur Petrosyan wrote:
> On 12/4/2020 12:36, Xu Wang wrote:
>> Because clk_prepare_enable() and clk_disable_unprepare() already checked
>> NULL clock parameter, so the additional checks are unnecessary, just
>> remove them.
>>
>> Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
>
> Reviewed-by: Artur Petrosyan <Arthur.Petrosyan@synopsys.com>
>
Acked-by: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-12-08 7:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04 8:36 [PATCH] usb: dwc2: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare Xu Wang
2020-12-08 7:29 ` Artur Petrosyan
2020-12-08 7:33 ` Minas Harutyunyan
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).