* [PATCH] can: mcp251x: fix error handling code in mcp251x_can_probe
@ 2022-10-24 5:37 Dongliang Mu
2022-10-24 8:10 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Dongliang Mu @ 2022-10-24 5:37 UTC (permalink / raw)
To: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vincent Mailhol,
Oliver Hartkopp, Stefan Mätje, Andy Shevchenko,
Sebastian Andrzej Siewior, Sebastian Würl,
Uwe Kleine-König
Cc: Dongliang Mu, linux-can, netdev, linux-kernel
In mcp251x_can_probe, if mcp251x_gpio_setup fails, it forgets to
unregister the can device.
Fix this by unregistering can device in mcp251x_can_probe.
Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
---
drivers/net/can/spi/mcp251x.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index c320de474f40..b4b280c0699d 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -1415,11 +1415,14 @@ static int mcp251x_can_probe(struct spi_device *spi)
ret = mcp251x_gpio_setup(priv);
if (ret)
- goto error_probe;
+ goto err_reg_candev;
netdev_info(net, "MCP%x successfully initialized.\n", priv->model);
return 0;
+err_reg_candev:
+ unregister_candev(net);
+
error_probe:
destroy_workqueue(priv->wq);
priv->wq = NULL;
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] can: mcp251x: fix error handling code in mcp251x_can_probe
2022-10-24 5:37 [PATCH] can: mcp251x: fix error handling code in mcp251x_can_probe Dongliang Mu
@ 2022-10-24 8:10 ` Andy Shevchenko
2022-10-24 8:43 ` Dongliang Mu
0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2022-10-24 8:10 UTC (permalink / raw)
To: Dongliang Mu
Cc: Wolfgang Grandegger, Marc Kleine-Budde, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Vincent Mailhol,
Oliver Hartkopp, Stefan Mätje, Sebastian Andrzej Siewior,
Sebastian Würl, Uwe Kleine-König, linux-can, netdev,
linux-kernel
On Mon, Oct 24, 2022 at 01:37:07PM +0800, Dongliang Mu wrote:
> In mcp251x_can_probe, if mcp251x_gpio_setup fails, it forgets to
> unregister the can device.
>
> Fix this by unregistering can device in mcp251x_can_probe.
Fixes tag?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] can: mcp251x: fix error handling code in mcp251x_can_probe
2022-10-24 8:10 ` Andy Shevchenko
@ 2022-10-24 8:43 ` Dongliang Mu
0 siblings, 0 replies; 3+ messages in thread
From: Dongliang Mu @ 2022-10-24 8:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Dongliang Mu, Wolfgang Grandegger, Marc Kleine-Budde,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Vincent Mailhol, Oliver Hartkopp, Stefan Mätje,
Sebastian Andrzej Siewior, Sebastian Würl,
Uwe Kleine-König, linux-can, netdev, linux-kernel
On Mon, Oct 24, 2022 at 4:16 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Oct 24, 2022 at 01:37:07PM +0800, Dongliang Mu wrote:
> > In mcp251x_can_probe, if mcp251x_gpio_setup fails, it forgets to
> > unregister the can device.
> >
> > Fix this by unregistering can device in mcp251x_can_probe.
>
> Fixes tag?
Fixes: 2d52dabbef60 ("can: mcp251x: add GPIO support")
This commit adds the mcp251x_gpio_setup function, but with an incorrect label.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-24 8:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-24 5:37 [PATCH] can: mcp251x: fix error handling code in mcp251x_can_probe Dongliang Mu
2022-10-24 8:10 ` Andy Shevchenko
2022-10-24 8:43 ` Dongliang Mu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).