Skip to content

Commit

Permalink
serial: of_serial: check the return value of clk_prepare_enable()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Masahiro Yamada authored and Greg Kroah-Hartman committed May 31, 2015
1 parent 3a63d22 commit 6f0c309
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/tty/serial/of_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 6f0c309

Please sign in to comment.