Skip to content

Commit

Permalink
can: mcp251xfd: mcp251xfd_probe(): fix an error pointer dereference i…
Browse files Browse the repository at this point in the history
…n probe

When we converted this code to use dev_err_probe() we accidentally
removed a return. It means that if devm_clk_get() it will lead to an
Oops when we call clk_get_rate() on the next line.

Fixes: cf8ee6d ("can: mcp251xfd: mcp251xfd_probe(): use dev_err_probe() to simplify error handling")
Link: https://lore.kernel.org/r/YJANZf13Qxd5Mhr1@mwanda
Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Manivannan Sadhasivam <[email protected]>
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
Dan Carpenter authored and marckleinebudde committed May 6, 2021
1 parent 8621436 commit 4cc7faa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2885,8 +2885,8 @@ static int mcp251xfd_probe(struct spi_device *spi)

clk = devm_clk_get(&spi->dev, NULL);
if (IS_ERR(clk))
dev_err_probe(&spi->dev, PTR_ERR(clk),
"Failed to get Oscillator (clock)!\n");
return dev_err_probe(&spi->dev, PTR_ERR(clk),
"Failed to get Oscillator (clock)!\n");
freq = clk_get_rate(clk);

/* Sanity check */
Expand Down

0 comments on commit 4cc7faa

Please sign in to comment.