]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: dwc3: of-simple: fix missing clk_disable_unprepare
authorAndreas Platschek <andreas.platschek@opentech.at>
Thu, 7 Dec 2017 10:32:20 +0000 (11:32 +0100)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 11 Dec 2017 10:35:36 +0000 (12:35 +0200)
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: 16adc674d0d6 ("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>
drivers/usb/dwc3/dwc3-of-simple.c

index c4a4d7bd27660225442e732e6be994c333b9b91b..762370dd7c75576b8b898c3861025d8ed27ebab4 100644 (file)
@@ -51,8 +51,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);
                }