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

fpga: socfpga-a10: disable clk on error in socfpga_a10_fpga_probe()

If fpga_mgr_register() fails, a clock is left undisabled.

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alexey Khoroshilov and committed by
Greg Kroah-Hartman
d9cc5a0e 8d52af67

+7 -1
+7 -1
drivers/fpga/socfpga-a10.c
··· 519 519 return -EBUSY; 520 520 } 521 521 522 - return fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager", 522 + ret = fpga_mgr_register(dev, "SoCFPGA Arria10 FPGA Manager", 523 523 &socfpga_a10_fpga_mgr_ops, priv); 524 + if (ret) { 525 + clk_disable_unprepare(priv->clk); 526 + return ret; 527 + } 528 + 529 + return 0; 524 530 } 525 531 526 532 static int socfpga_a10_fpga_remove(struct platform_device *pdev)