All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krishna Kumar <krkumar2@in.ibm.com>
To: rusty@rustcorp.com.au, mst@redhat.com
Cc: netdev@vger.kernel.org, levinsasha928@gmail.com,
	Krishna Kumar <krkumar2@in.ibm.com>,
	davem@davemloft.net
Subject: [PATCH] virtio_net: Give indication on device probe failure.
Date: Thu, 24 Nov 2011 13:54:21 +0530	[thread overview]
Message-ID: <20111124082421.26821.71126.sendpatchset@krkumar2.in.ibm.com> (raw)

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;
 }
 

             reply	other threads:[~2011-11-24  8:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-24  8:24 Krishna Kumar [this message]
2011-11-24  8:35 ` [PATCH] virtio_net: Give indication on device probe failure Sasha Levin
2011-11-24  8:47   ` Krishna Kumar2
2011-11-24  9:24     ` Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111124082421.26821.71126.sendpatchset@krkumar2.in.ibm.com \
    --to=krkumar2@in.ibm.com \
    --cc=davem@davemloft.net \
    --cc=levinsasha928@gmail.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.