Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abe8e59a authored by Andreas Platschek's avatar Andreas Platschek Committed by Greg Kroah-Hartman
Browse files

usb: dwc3: of-simple: fix missing clk_disable_unprepare




[ Upstream commit ded600ea ]

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: 16adc674 ("usb: dwc3: ep0: fix setup_packet_pending initialization")

Signed-off-by: default avatarAndreas Platschek <andreas.platschek@opentech.at>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 98b35258
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);
		}