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 <yamada.masahiro@socionext.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Masahiro Yamada 2015-05-25 15:03:32 +09:00 committed by Greg Kroah-Hartman
parent 3a63d22425
commit 6f0c3091e7
1 changed files with 4 additions and 1 deletions

View File

@ -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. */