Commit f61bd058 authored by Wei Yongjun's avatar Wei Yongjun Committed by Marc Kleine-Budde

can: mscan-mpc5xxx: fix return value check in mpc512x_can_get_clock()

In case of error, the function clk_get() returns ERR_PTR()
and never returns NULL pointer. The NULL test in the error
handling should be replaced with IS_ERR().

dpatch engine is used to auto generated this patch.
(https://github.com/weiyj/dpatch)

Cc: stable <stable@vger.kernel.org>
Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: default avatarWolfgang Grandegger <wg@grandegger.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 56b9f301
...@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, ...@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
if (!clock_name || !strcmp(clock_name, "sys")) { if (!clock_name || !strcmp(clock_name, "sys")) {
sys_clk = clk_get(&ofdev->dev, "sys_clk"); sys_clk = clk_get(&ofdev->dev, "sys_clk");
if (!sys_clk) { if (IS_ERR(sys_clk)) {
dev_err(&ofdev->dev, "couldn't get sys_clk\n"); dev_err(&ofdev->dev, "couldn't get sys_clk\n");
goto exit_unmap; goto exit_unmap;
} }
...@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, ...@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
if (clocksrc < 0) { if (clocksrc < 0) {
ref_clk = clk_get(&ofdev->dev, "ref_clk"); ref_clk = clk_get(&ofdev->dev, "ref_clk");
if (!ref_clk) { if (IS_ERR(ref_clk)) {
dev_err(&ofdev->dev, "couldn't get ref_clk\n"); dev_err(&ofdev->dev, "couldn't get ref_clk\n");
goto exit_unmap; goto exit_unmap;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment