Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: udc-xilinx: Fix an error handling path in 'xudc_probe()'

A successful 'clk_prepare_enable()' call should be balanced by a
corresponding 'clk_disable_unprepare()' call in the error handling path
of the probe, as already done in the remove function.

Fixes: 24749229211c ("usb: gadget: udc-xilinx: Add clock support")
Reviewed-by: Shubhrajyoti Datta <shubhraj@xilinx.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/ec61a89b83ce34b53a3bdaacfd1413a9869cc608.1636302246.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
3b8599a6 51f22461

+4 -1
+4 -1
drivers/usb/gadget/udc/udc-xilinx.c
··· 2136 2136 2137 2137 ret = usb_add_gadget_udc(&pdev->dev, &udc->gadget); 2138 2138 if (ret) 2139 - goto fail; 2139 + goto err_disable_unprepare_clk; 2140 2140 2141 2141 udc->dev = &udc->gadget.dev; 2142 2142 ··· 2155 2155 udc->dma_enabled ? "with DMA" : "without DMA"); 2156 2156 2157 2157 return 0; 2158 + 2159 + err_disable_unprepare_clk: 2160 + clk_disable_unprepare(udc->clk); 2158 2161 fail: 2159 2162 dev_err(&pdev->dev, "probe failed, %d\n", ret); 2160 2163 return ret;