In the probe function, we do not check the return value of the clk_prepare_enable(). But in actually, the clk_prepare_enable() may fails, so check the return value when we enable the clocks. Signed-off-by: Huang Shijie <b32955@xxxxxxxxxxxxx> --- drivers/tty/serial/imx.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index bfdf764..2aec568 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c @@ -1593,8 +1593,15 @@ static int serial_imx_probe(struct platform_device *pdev) return ret; } - clk_prepare_enable(sport->clk_per); - clk_prepare_enable(sport->clk_ipg); + ret = clk_prepare_enable(sport->clk_per); + if (ret) + return ret; + + ret = clk_prepare_enable(sport->clk_ipg); + if (ret) { + clk_disable_unprepare(sport->clk_per); + return ret; + } sport->port.uartclk = clk_get_rate(sport->clk_per); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html