Skip to content

Commit 6f0c309

Browse files
masahir0ygregkh
authored andcommitted
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>
1 parent 3a63d22 commit 6f0c309

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/tty/serial/of_serial.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,10 @@ static int of_platform_serial_setup(struct platform_device *ofdev,
7474
return PTR_ERR(info->clk);
7575
}
7676

77-
clk_prepare_enable(info->clk);
77+
ret = clk_prepare_enable(info->clk);
78+
if (ret < 0)
79+
return ret;
80+
7881
clk = clk_get_rate(info->clk);
7982
}
8083
/* If current-speed was set, then try not to change it. */

0 commit comments

Comments
 (0)