Skip to content

Commit f61bd05

Browse files
Wei Yongjunmarckleinebudde
authored andcommitted
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 <[email protected]> Signed-off-by: Wei Yongjun <[email protected]> Acked-by: Wolfgang Grandegger <[email protected]> Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 56b9f30 commit f61bd05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/can/mscan/mpc5xxx_can.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
181181

182182
if (!clock_name || !strcmp(clock_name, "sys")) {
183183
sys_clk = clk_get(&ofdev->dev, "sys_clk");
184-
if (!sys_clk) {
184+
if (IS_ERR(sys_clk)) {
185185
dev_err(&ofdev->dev, "couldn't get sys_clk\n");
186186
goto exit_unmap;
187187
}
@@ -204,7 +204,7 @@ static u32 __devinit mpc512x_can_get_clock(struct platform_device *ofdev,
204204

205205
if (clocksrc < 0) {
206206
ref_clk = clk_get(&ofdev->dev, "ref_clk");
207-
if (!ref_clk) {
207+
if (IS_ERR(ref_clk)) {
208208
dev_err(&ofdev->dev, "couldn't get ref_clk\n");
209209
goto exit_unmap;
210210
}

0 commit comments

Comments
 (0)