Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1300101 > unrolled thread

[PATCH 0/5] xen-netback: Fine-tuning for three function implementations

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2016-01-02 19:00 +0100
Last post2016-01-04 12:10 +0100
Articles 6 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 0/5] xen-netback: Fine-tuning for three function  implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 19:00 +0100
    [PATCH 2/5] xen-netback: Delete an unnecessary goto statement in  connect_rings() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 19:00 +0100
    [PATCH 5/5] xen-netback: Delete an unnecessary variable  initialisation in xen_register_watchers() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-01-02 19:10 +0100
    Re: [PATCH 0/5] xen-netback: Fine-tuning for three function  implementations Joe Perches <joe@perches.com> - 2016-01-03 02:40 +0100
    Re: [PATCH 0/5] xen-netback: Fine-tuning for three function  implementations Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-04 10:50 +0100
    Re: [PATCH 0/5] xen-netback: Fine-tuning for three function  implementations Wei Liu <wei.liu2@citrix.com> - 2016-01-04 12:10 +0100

#1300101 — [PATCH 0/5] xen-netback: Fine-tuning for three function implementations

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 19:00 +0100
Subject[PATCH 0/5] xen-netback: Fine-tuning for three function implementations
Message-ID<qMyD7-2In-3@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 18:46:45 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (5):
  Delete an unnecessary assignment in connect_rings()
  Delete an unnecessary goto statement in connect_rings()
  Replace a variable initialisation by an assignment in read_xenbus_vif_flags()
  Replace a variable initialisation by an assignment in xen_register_watchers()
  Delete an unnecessary variable initialisation in xen_register_watchers()

 drivers/net/xen-netback/xenbus.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1300102 — [PATCH 2/5] xen-netback: Delete an unnecessary goto statement in connect_rings()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 19:00 +0100
Subject[PATCH 2/5] xen-netback: Delete an unnecessary goto statement in connect_rings()
Message-ID<qMyD8-2In-23@gated-at.bofh.it>
In reply to#1300101
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 17:50:21 +0100

One goto statement referred to a source code position directly behind it.
Thus omit such an unnecessary jump.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/xen-netback/xenbus.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index 7f2895d..d4947e1 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -933,13 +933,11 @@ static int connect_rings(struct backend_info *be, struct xenvif_queue *queue)
 	/* Map the shared frame, irq etc. */
 	err = xenvif_connect(queue, tx_ring_ref, rx_ring_ref,
 			     tx_evtchn, rx_evtchn);
-	if (err) {
+	if (err)
 		xenbus_dev_fatal(dev, err,
 				 "mapping shared-frames %lu/%lu port tx %u rx %u",
 				 tx_ring_ref, rx_ring_ref,
 				 tx_evtchn, rx_evtchn);
-		goto err;
-	}
 
 err: /* Regular return falls through with err == 0 */
 	kfree(xspath);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300104 — [PATCH 5/5] xen-netback: Delete an unnecessary variable initialisation in xen_register_watchers()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2016-01-02 19:10 +0100
Subject[PATCH 5/5] xen-netback: Delete an unnecessary variable initialisation in xen_register_watchers()
Message-ID<qMyMP-31n-15@gated-at.bofh.it>
In reply to#1300101
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 2 Jan 2016 18:28:26 +0100

Omit explicit initialisation at the beginning for one local variable
that is redefined before its first use.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/net/xen-netback/xenbus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c
index e8dfc3d..55f0735 100644
--- a/drivers/net/xen-netback/xenbus.c
+++ b/drivers/net/xen-netback/xenbus.c
@@ -685,7 +685,7 @@ static void xen_net_rate_changed(struct xenbus_watch *watch,
 
 static int xen_register_watchers(struct xenbus_device *dev, struct xenvif *vif)
 {
-	int err = 0;
+	int err;
 	char *node;
 	unsigned maxlen;
 
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300165

FromJoe Perches <joe@perches.com>
Date2016-01-03 02:40 +0100
Message-ID<qMFOi-7gt-5@gated-at.bofh.it>
In reply to#1300101
On Sat, 2016-01-02 at 18:50 +0100, SF Markus Elfring wrote:
> A few update suggestions were taken into account
> from static source code analysis.

While static analysis can be useful, I don't think these
specific conversions are generally useful.

Perhaps it would be more useful to convert the string
duplication or snprintf logic to kstrdup/kasprintf

This:

	if (num_queues == 1) {
		xspath = kzalloc(strlen(dev->otherend) + 1, GFP_KERNEL);
		if (!xspath) {
			xenbus_dev_fatal(dev, -ENOMEM,
					 "reading ring references");
			return -ENOMEM;
		}
		strcpy(xspath, dev->otherend);
	} else {
		xspathsize = strlen(dev->otherend) + xenstore_path_ext_size;
		xspath = kzalloc(xspathsize, GFP_KERNEL);
		if (!xspath) {
			xenbus_dev_fatal(dev, -ENOMEM,
					 "reading ring references");
			return -ENOMEM;
		}
		snprintf(xspath, xspathsize, "%s/queue-%u", dev->otherend,
			 queue->id);
	}

could be simplified to something like:

	if (num_queues == 1)
		xspath = kstrdup(dev->otherend, GFP_KERNEL);
	else
		xspath = kasprintf(GFP_KERNEL, "%s/queue-%u",
				   dev->otherend, queue->id);
	if (!xspath)
		etc...

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300583

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-04 10:50 +0100
Message-ID<qN9W2-1HD-19@gated-at.bofh.it>
In reply to#1300101
The original code is fine.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1300632

FromWei Liu <wei.liu2@citrix.com>
Date2016-01-04 12:10 +0100
Message-ID<qNbbs-2FI-17@gated-at.bofh.it>
In reply to#1300101
I think the original code is fine.

Wei.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web