Skip to content

Commit b5c1a23

Browse files
Nicholas Mc Guiremarckleinebudde
authored andcommitted
can: mpc5xxx_can: check of_iomap return before use
of_iomap() can return NULL so that return needs to be checked and NULL treated as failure. While at it also take care of the missing of_node_put() in the error path. Signed-off-by: Nicholas Mc Guire <[email protected]> Fixes: commit afa17a5 ("net/can: add driver for mscan family & mpc52xx_mscan") Signed-off-by: Marc Kleine-Budde <[email protected]>
1 parent 393753b commit b5c1a23

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/can/mscan/mpc5xxx_can.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
8686
return 0;
8787
}
8888
cdm = of_iomap(np_cdm, 0);
89+
if (!cdm) {
90+
of_node_put(np_cdm);
91+
dev_err(&ofdev->dev, "can't map clock node!\n");
92+
return 0;
93+
}
8994

9095
if (in_8(&cdm->ipb_clk_sel) & 0x1)
9196
freq *= 2;

0 commit comments

Comments
 (0)