瀏覽代碼

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>
Masahiro Yamada 10 年之前
父節點
當前提交
6f0c3091e7
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      drivers/tty/serial/of_serial.c

+ 4 - 1
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. */