netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio_net: Give indication on device probe failure.
@ 2011-11-24  8:24 Krishna Kumar
  2011-11-24  8:35 ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kumar @ 2011-11-24  8:24 UTC (permalink / raw)
  To: rusty, mst; +Cc: netdev, levinsasha928, Krishna Kumar, davem

Provide an indication when the virtio_net device fails to
initialize.

Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
---
 drivers/net/virtio_net.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff -ruNp org/drivers/net/virtio_net.c new/drivers/net/virtio_net.c
--- org/drivers/net/virtio_net.c	2011-11-24 11:53:08.000000000 +0530
+++ new/drivers/net/virtio_net.c	2011-11-24 13:51:32.000000000 +0530
@@ -971,7 +971,7 @@ static void virtnet_config_changed(struc
 
 static int virtnet_probe(struct virtio_device *vdev)
 {
-	int err;
+	int err = -ENOMEM;
 	struct net_device *dev;
 	struct virtnet_info *vi;
 	struct virtqueue *vqs[3];
@@ -982,7 +982,7 @@ static int virtnet_probe(struct virtio_d
 	/* Allocate ourselves a network device with room for our info */
 	dev = alloc_etherdev(sizeof(struct virtnet_info));
 	if (!dev)
-		return -ENOMEM;
+		goto out;
 
 	/* Set up network device as normal. */
 	dev->priv_flags |= IFF_UNICAST_FLT;
@@ -1032,7 +1032,6 @@ static int virtnet_probe(struct virtio_d
 	vdev->priv = vi;
 	vi->pages = NULL;
 	vi->stats = alloc_percpu(struct virtnet_stats);
-	err = -ENOMEM;
 	if (vi->stats == NULL)
 		goto free;
 
@@ -1104,6 +1103,8 @@ free_stats:
 	free_percpu(vi->stats);
 free:
 	free_netdev(dev);
+out:
+	dev_err(&vdev->dev, "Device probe failed with errno: %d\n", err);
 	return err;
 }
 

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

* Re: [PATCH] virtio_net: Give indication on device probe failure.
  2011-11-24  8:24 [PATCH] virtio_net: Give indication on device probe failure Krishna Kumar
@ 2011-11-24  8:35 ` Sasha Levin
  2011-11-24  8:47   ` Krishna Kumar2
  0 siblings, 1 reply; 4+ messages in thread
From: Sasha Levin @ 2011-11-24  8:35 UTC (permalink / raw)
  To: Krishna Kumar; +Cc: rusty, mst, netdev, davem

On Thu, 2011-11-24 at 13:54 +0530, Krishna Kumar wrote:
> Provide an indication when the virtio_net device fails to
> initialize.
> 
> Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
> ---

[snip]

You already get a warning from the thingie that probes PCI:

[    1.166311] virtio_net: probe of virtio1 failed with error -12

-- 

Sasha.

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

* Re: [PATCH] virtio_net: Give indication on device probe failure.
  2011-11-24  8:35 ` Sasha Levin
@ 2011-11-24  8:47   ` Krishna Kumar2
  2011-11-24  9:24     ` Sasha Levin
  0 siblings, 1 reply; 4+ messages in thread
From: Krishna Kumar2 @ 2011-11-24  8:47 UTC (permalink / raw)
  To: Sasha Levin; +Cc: davem, mst, netdev, rusty

Sasha Levin <levinsasha928@gmail.com> wrote on 11/24/2011 02:05:22 PM:

> > Provide an indication when the virtio_net device fails to
> > initialize.
> >
> > Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
> > ---
>
> [snip]
>
> You already get a warning from the thingie that probes PCI:
>
> [    1.166311] virtio_net: probe of virtio1 failed with error -12

Ah, I created this patch based on your feedback:

> I would suggest adding some output if we take the failure path, since
> while the guest does boot peacefully, it doesn't have a network
> interface and there's nothing in the boot log to indicate anything has
> gone wrong.

Is this probe error enough to find there was a problem,
or do you think detailed error in all fail cases is
required?

Thanks,

- KK

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

* Re: [PATCH] virtio_net: Give indication on device probe failure.
  2011-11-24  8:47   ` Krishna Kumar2
@ 2011-11-24  9:24     ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2011-11-24  9:24 UTC (permalink / raw)
  To: Krishna Kumar2; +Cc: davem, mst, netdev, rusty

On Thu, 2011-11-24 at 14:17 +0530, Krishna Kumar2 wrote:
> Sasha Levin <levinsasha928@gmail.com> wrote on 11/24/2011 02:05:22 PM:
> 
> > > Provide an indication when the virtio_net device fails to
> > > initialize.
> > >
> > > Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
> > > ---
> >
> > [snip]
> >
> > You already get a warning from the thingie that probes PCI:
> >
> > [    1.166311] virtio_net: probe of virtio1 failed with error -12
> 
> Ah, I created this patch based on your feedback:
> 
> > I would suggest adding some output if we take the failure path, since
> > while the guest does boot peacefully, it doesn't have a network
> > interface and there's nothing in the boot log to indicate anything has
> > gone wrong.
> 
> Is this probe error enough to find there was a problem,
> or do you think detailed error in all fail cases is
> required?
> 
> Thanks,
> 
> - KK
> 

Nope, I must have missed that error. Sorry about that.

More warnings there can be useful, but it's true for the probe function
of all other virtio drivers as well :)

-- 

Sasha.

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

end of thread, other threads:[~2011-11-24  9:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-24  8:24 [PATCH] virtio_net: Give indication on device probe failure Krishna Kumar
2011-11-24  8:35 ` Sasha Levin
2011-11-24  8:47   ` Krishna Kumar2
2011-11-24  9:24     ` Sasha Levin

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).