All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
@ 2023-05-05 18:39 Christophe JAILLET
  2023-05-06  7:41 ` Simon Horman
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christophe JAILLET @ 2023-05-05 18:39 UTC (permalink / raw)
  To: Tobias Waldekranz, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Greg Kroah-Hartman
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, netdev

Should of_mdiobus_register() fail, a previous usb_get_dev() call should be
undone as in the .disconnect function.

Fixes: 04e37d92fbed ("net: phy: add marvell usb to mdio controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/mdio/mdio-mvusb.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mdio/mdio-mvusb.c b/drivers/net/mdio/mdio-mvusb.c
index 68fc55906e78..554837c21e73 100644
--- a/drivers/net/mdio/mdio-mvusb.c
+++ b/drivers/net/mdio/mdio-mvusb.c
@@ -67,6 +67,7 @@ static int mvusb_mdio_probe(struct usb_interface *interface,
 	struct device *dev = &interface->dev;
 	struct mvusb_mdio *mvusb;
 	struct mii_bus *mdio;
+	int ret;
 
 	mdio = devm_mdiobus_alloc_size(dev, sizeof(*mvusb));
 	if (!mdio)
@@ -87,7 +88,15 @@ static int mvusb_mdio_probe(struct usb_interface *interface,
 	mdio->write = mvusb_mdio_write;
 
 	usb_set_intfdata(interface, mvusb);
-	return of_mdiobus_register(mdio, dev->of_node);
+	ret = of_mdiobus_register(mdio, dev->of_node);
+	if (ret)
+		goto put_dev;
+
+	return 0;
+
+put_dev:
+	usb_put_dev(mvusb->udev);
+	return ret;
 }
 
 static void mvusb_mdio_disconnect(struct usb_interface *interface)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
  2023-05-05 18:39 [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() Christophe JAILLET
@ 2023-05-06  7:41 ` Simon Horman
  2023-05-06 13:18 ` Andrew Lunn
  2023-05-07 14:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2023-05-06  7:41 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Tobias Waldekranz, Andrew Lunn, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Greg Kroah-Hartman, linux-kernel,
	kernel-janitors, netdev

On Fri, May 05, 2023 at 08:39:33PM +0200, Christophe JAILLET wrote:
> Should of_mdiobus_register() fail, a previous usb_get_dev() call should be
> undone as in the .disconnect function.
> 
> Fixes: 04e37d92fbed ("net: phy: add marvell usb to mdio controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
  2023-05-05 18:39 [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() Christophe JAILLET
  2023-05-06  7:41 ` Simon Horman
@ 2023-05-06 13:18 ` Andrew Lunn
  2023-05-07 14:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-05-06 13:18 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Tobias Waldekranz, Heiner Kallweit, Russell King,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Florian Fainelli, Greg Kroah-Hartman, linux-kernel,
	kernel-janitors, netdev

On Fri, May 05, 2023 at 08:39:33PM +0200, Christophe JAILLET wrote:
> Should of_mdiobus_register() fail, a previous usb_get_dev() call should be
> undone as in the .disconnect function.
> 
> Fixes: 04e37d92fbed ("net: phy: add marvell usb to mdio controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
  2023-05-05 18:39 [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() Christophe JAILLET
  2023-05-06  7:41 ` Simon Horman
  2023-05-06 13:18 ` Andrew Lunn
@ 2023-05-07 14:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-05-07 14:00 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: tobias, andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	f.fainelli, gregkh, linux-kernel, kernel-janitors, netdev

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri,  5 May 2023 20:39:33 +0200 you wrote:
> Should of_mdiobus_register() fail, a previous usb_get_dev() call should be
> undone as in the .disconnect function.
> 
> Fixes: 04e37d92fbed ("net: phy: add marvell usb to mdio controller")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/mdio/mdio-mvusb.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)

Here is the summary with links:
  - [net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe()
    https://git.kernel.org/netdev/net/c/27c1eaa07283

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-07 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 18:39 [PATCH net] net: mdio: mvusb: Fix an error handling path in mvusb_mdio_probe() Christophe JAILLET
2023-05-06  7:41 ` Simon Horman
2023-05-06 13:18 ` Andrew Lunn
2023-05-07 14:00 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.