Skip to content

Commit

Permalink
usb: dwc3: of-simple: fix missing clk_disable_unprepare
Browse files Browse the repository at this point in the history
[ Upstream commit ded600e ]

If of_clk_get() fails, the clean-up of already initialized clocks should be
the same as when clk_prepare_enable() fails. Thus a clk_disable_unprepare()
for each clock should be called before the clk_put().

Found by Linux Driver Verification project (linuxtesting.org).

Fixes: 16adc67 ("usb: dwc3: ep0: fix setup_packet_pending initialization")

Signed-off-by: Andreas Platschek <andreas.platschek@opentech.at>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andreas Platschek authored and Greg Kroah-Hartman committed Feb 25, 2018
1 parent 98b3525 commit abe8e59
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/usb/dwc3/dwc3-of-simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)

clk = of_clk_get(np, i);
if (IS_ERR(clk)) {
while (--i >= 0)
while (--i >= 0) {
clk_disable_unprepare(simple->clks[i]);
clk_put(simple->clks[i]);
}
return PTR_ERR(clk);
}

Expand Down

0 comments on commit abe8e59

Please sign in to comment.