From: Masahiro Yamada Date: Mon, 25 May 2015 06:03:32 +0000 (+0900) Subject: serial: of_serial: check the return value of clk_prepare_enable() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6f0c3091e73df7ad1393c3400d168b9777b4a63c;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git serial: of_serial: check the return value of clk_prepare_enable() The function clk_prepare_enable() may fail, and in that case it does not make sense to proceed. Let's check its return code and error out if it is a negative value. Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index d353fdf55ac1..6823df99bd76 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c @@ -74,7 +74,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev, return PTR_ERR(info->clk); } - clk_prepare_enable(info->clk); + ret = clk_prepare_enable(info->clk); + if (ret < 0) + return ret; + clk = clk_get_rate(info->clk); } /* If current-speed was set, then try not to change it. */