[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210503164732.GB3958@thinkpad>
Date: Mon, 3 May 2021 22:17:32 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Marc Kleine-Budde <mkl@...gutronix.de>,
Thomas Kopp <thomas.kopp@...rochip.com>,
Wolfgang Grandegger <wg@...ndegger.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, linux-can@...r.kernel.org,
netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH net] can: mcp251xfd: fix an error pointer dereference in
probe
On Mon, May 03, 2021 at 05:49:09PM +0300, Dan Carpenter wrote:
> 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: cf8ee6de2543 ("can: mcp251xfd: mcp251xfd_probe(): use dev_err_probe() to simplify error handling")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Reviewed-by: Manivannan Sadhasivam <mani@...nel.org>
Thanks,
Mani
> ---
> drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 970dc570e7a5..f122976e90da 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> @@ -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 */
> --
> 2.30.2
>
Powered by blists - more mailing lists