[PATCH 1/1] drivers:staging: fix return value check in fsl_mx6_enable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



in fsl_mx6_enable, the second time of calling clk_prepare_enable()
may fail, so its return value should also be checked. the clk enabled
by the first invocation of clk_prepare_enable should be disabled
on the error path.

Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@xxxxxxx>
---
 drivers/staging/most/dim2/dim2.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/dim2/dim2.c b/drivers/staging/most/dim2/dim2.c
index 44d3252d4612..4204cfba6b48 100644
--- a/drivers/staging/most/dim2/dim2.c
+++ b/drivers/staging/most/dim2/dim2.c
@@ -944,7 +944,12 @@ static int fsl_mx6_enable(struct platform_device *pdev)
 		}
 
 		writel(0x888, dev->io_base + 0x38);
-		clk_prepare_enable(dev->clk_pll);
+		ret = clk_prepare_enable(dev->clk_pll);
+		if (ret) {
+			dev_err(&pdev->dev, "%s\n", "clk_prepare_enable failed");
+			clk_disable_unprepare(dev->clk);
+			return ret;
+		}
 	}
 
 	return 0;
-- 
2.17.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux