diff options
author | Wei Yongjun <yongjun_wei@trendmicro.com.cn> | 2012-09-21 11:09:47 +0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2012-09-22 01:58:48 +0400 |
commit | f61bd0585dfc7d99db4936d7467de4ca8e2f7ea0 (patch) | |
tree | d496fda833a14cf8221c7fcb71e8e0044accd9c3 /drivers/net/can/mscan | |
parent | 56b9f30198875f199d00554c5e5001f63c5fc8ad (diff) | |
download | linux-f61bd0585dfc7d99db4936d7467de4ca8e2f7ea0.tar.xz |
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/mscan')
-rw-r--r-- | drivers/net/can/mscan/mpc5xxx_can.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c index 06adf881ea24..524ef96dc24d 100644 --- a/drivers/net/can/mscan/mpc5xxx_can.c +++ b/drivers/net/can/mscan/mpc5xxx_can.c @@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, if (!clock_name || !strcmp(clock_name, "sys")) { 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"); goto exit_unmap; } @@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev, if (clocksrc < 0) { 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"); goto exit_unmap; } |