Skip to contentSkip to conversation

Fix ERROR: trailing statements should be on next line

PATCH In review Maciek Fijalkowski 6 participants 14 messages May 14, 2017 – May 15, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Fix ERROR: trailing statements should be on next line

From: Maciej Fijalkowski <[email protected]>

---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +2 -1
index 9320d96..f20dfb8 100644
@@ -217,7 +217,8 @@ static void give_pages(struct receive_queue *rq, struct page *page)
 	struct page *end;
 
 	/* Find end of list, sew whole thing into vi->rq.pages. */
-	for (end = page; end->private; end = (struct page *)end->private);
+	for (end = page; end->private; end = (struct page *)end->private)
+		;
 	end->private = (unsigned long)rq->pages;
 	rq->pages = page;
 }
Signature · 1 line
2.4.11
#1 lore raw

PATCH 2/3 Fix ERROR: Macros with complex values should be enclosed in parentheses

From: Maciej Fijalkowski <[email protected]>

---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio_net.c +2 -2
index f20dfb8..6c8170c 100644
@@ -2663,7 +2663,7 @@ static struct virtio_device_id id_table[] = {
 };
 
 #define VIRTNET_FEATURES \
-	VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
+	(VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
 	VIRTIO_NET_F_MAC, \
 	VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
 	VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
@@ -2672,7 +2672,7 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
 	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
-	VIRTIO_NET_F_MTU
+	VIRTIO_NET_F_MTU)
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
Signature · 1 line
2.4.11
#6 lore raw

PATCH 2/3 Fix ERROR: Macros with complex values should be enclosed in parentheses

In reply to Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio_net.c +2 -2
index f20dfb8..6c8170c 100644
@@ -2663,7 +2663,7 @@ static struct virtio_device_id id_table[] = {
 };
 
 #define VIRTNET_FEATURES \
-	VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
+	(VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
 	VIRTIO_NET_F_MAC, \
 	VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
 	VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
@@ -2672,7 +2672,7 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
 	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
-	VIRTIO_NET_F_MTU
+	VIRTIO_NET_F_MTU)
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
Signature · 1 line
2.4.11
#7 lore raw

PATCH 3/3 Fix ERROR: code indent should use tabs where possible

In reply to Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
index 6c8170c..5d71e9f 100644
@@ -2717,7 +2717,7 @@ static __init int virtio_net_driver_init(void)
 	if (ret)
 		goto err_dead;
 
-        ret = register_virtio_driver(&virtio_net_driver);
+	ret = register_virtio_driver(&virtio_net_driver);
 	if (ret)
 		goto err_virtio;
 	return 0;
Signature · 1 line
2.4.11
#9 lore raw

PATCH 3/3 Fix ERROR: code indent should use tabs where possible

In reply to Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
index 6c8170c..5d71e9f 100644
@@ -2717,7 +2717,7 @@ static __init int virtio_net_driver_init(void)
 	if (ret)
 		goto err_dead;
 
-        ret = register_virtio_driver(&virtio_net_driver);
+	ret = register_virtio_driver(&virtio_net_driver);
 	if (ret)
 		goto err_virtio;
 	return 0;
Signature · 1 line
2.4.11
#2 lore raw

Re: [PATCH 2/3] Fix ERROR: Macros with complex values should be enclosed in parentheses

In reply to Maciek Fijalkowski
url: https://github.com/0day-ci/linux/commits/Maciek-Fijalkowski/Fix-ERROR-trailing-statements-should-be-on-next-line/20170515-021304 config: x86_64-acpi-redef (attached as .config) compiler: gcc-6…

Hi Maciej,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.12-rc1 next-20170512]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Maciek-Fijalkowski/Fix-ERROR-trailing-statements-should-be-on-next-line/20170515-021304
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:

        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

drivers//net/virtio_net.c:2647:20: warning: left-hand operand of comma expression has no effect [-Wunused-value]

     (VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
                       ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2647:45: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     (VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
                                                ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2648:18: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_MAC, \
                     ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2649:24: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
                           ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2649:47: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
                                                  ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2649:71: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
                                                                          ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2650:23: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
                          ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2650:48: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
                                                   ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2650:73: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
                                                                            ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2651:24: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, \
                           ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2651:48: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, \
                                                   ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2652:24: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \
                           ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2652:45: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \
                                                ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2652:67: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \
                                                                      ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2653:22: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
                         ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2653:46: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
                                                 ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2654:29: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
                                ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2654:46: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
                                                 ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
   drivers//net/virtio_net.c:2655:28: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     VIRTIO_NET_F_CTRL_MAC_ADDR, \
                               ^
>> drivers//net/virtio_net.c:2659:2: note: in expansion of macro 'VIRTNET_FEATURES'
     VIRTNET_FEATURES,
     ^~~~~~~~~~~~~~~~
>> drivers//net/virtio_net.c:2647:2: error: initializer element is not constant
     (VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
     ^

vim +/VIRTNET_FEATURES +2659 drivers//net/virtio_net.c

296f96fc Rusty Russell      2007-10-22  2641  static struct virtio_device_id id_table[] = {
296f96fc Rusty Russell      2007-10-22  2642  	{ VIRTIO_ID_NET, VIRTIO_DEV_ANY_ID },
296f96fc Rusty Russell      2007-10-22  2643  	{ 0 },
296f96fc Rusty Russell      2007-10-22  2644  };
296f96fc Rusty Russell      2007-10-22  2645  
f3358507 Michael S. Tsirkin 2016-11-04  2646  #define VIRTNET_FEATURES \
d66a5bc5 Maciej Fijalkowski 2017-05-14 @2647  	(VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
f3358507 Michael S. Tsirkin 2016-11-04  2648  	VIRTIO_NET_F_MAC, \
f3358507 Michael S. Tsirkin 2016-11-04  2649  	VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
f3358507 Michael S. Tsirkin 2016-11-04  2650  	VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
f3358507 Michael S. Tsirkin 2016-11-04  2651  	VIRTIO_NET_F_GUEST_ECN, VIRTIO_NET_F_GUEST_UFO, \
f3358507 Michael S. Tsirkin 2016-11-04  2652  	VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ, \
f3358507 Michael S. Tsirkin 2016-11-04  2653  	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
f3358507 Michael S. Tsirkin 2016-11-04  2654  	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
f3358507 Michael S. Tsirkin 2016-11-04  2655  	VIRTIO_NET_F_CTRL_MAC_ADDR, \
d66a5bc5 Maciej Fijalkowski 2017-05-14  2656  	VIRTIO_NET_F_MTU)
f3358507 Michael S. Tsirkin 2016-11-04  2657  
c45a6816 Rusty Russell      2008-05-02  2658  static unsigned int features[] = {
f3358507 Michael S. Tsirkin 2016-11-04 @2659  	VIRTNET_FEATURES,
f3358507 Michael S. Tsirkin 2016-11-04  2660  };

f3358507 Michael S. Tsirkin 2016-11-04 2661
f3358507 Michael S. Tsirkin 2016-11-04 2662 static unsigned int features_legacy[] = {

:::::: The code at line 2659 was first introduced by commit
:::::: f3358507c11999c91abf54744658bccd49b5879c virtio-net: drop legacy features in virtio 1 mode

:::::: TO: Michael S. Tsirkin <[email protected]> :::::: CC: David S. Miller <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
Virtualization mailing list [email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#3 lore raw

Re: [PATCH 2/3] Fix ERROR: Macros with complex values should be enclosed in parentheses

In reply to Maciek Fijalkowski
Quoted 1 line · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

Hi Maciek

Please include some commit message, even if it is just the checkpatch error you are fixing.

Please include the subsystem/driver you are patch in the subject line. Also, your subject of Fix ERROR: makes it sound a lot worse than it is.

net: virtio: Fix checkpatch error Complex macros should use ()

Also, you should at least compile test your change. It is clearly wrong, as shown by 0-day.

Andrew

#4 lore raw

Re: [PATCH 2/3] Fix ERROR: Macros with complex values should be enclosed in parentheses

In reply to Maciek Fijalkowski
Quoted 1 line · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

Hi Maciek

Please include some commit message, even if it is just the checkpatch error you are fixing.

Please include the subsystem/driver you are patch in the subject line. Also, your subject of Fix ERROR: makes it sound a lot worse than it is.

net: virtio: Fix checkpatch error Complex macros should use ()

Also, you should at least compile test your change. It is clearly wrong, as shown by 0-day.

Andrew

#5 lore raw

Re: [PATCH 2/3] Fix ERROR: Macros with complex values should be enclosed in parentheses

In reply to Maciek Fijalkowski
Quoted 3 lines · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

This is not a complex value.

Quoted 28 lines
---
 drivers/net/virtio_net.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/virtio_net.c +2 -2
index f20dfb8..6c8170c 100644
@@ -2663,7 +2663,7 @@ static struct virtio_device_id id_table[] = {
 };
 
 #define VIRTNET_FEATURES \
-	VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
+	(VIRTIO_NET_F_CSUM, VIRTIO_NET_F_GUEST_CSUM, \
 	VIRTIO_NET_F_MAC, \
 	VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6, \
 	VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6, \
@@ -2672,7 +2672,7 @@ static struct virtio_device_id id_table[] = {
 	VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN, \
 	VIRTIO_NET_F_GUEST_ANNOUNCE, VIRTIO_NET_F_MQ, \
 	VIRTIO_NET_F_CTRL_MAC_ADDR, \
-	VIRTIO_NET_F_MTU
+	VIRTIO_NET_F_MTU)
 
 static unsigned int features[] = {
 	VIRTNET_FEATURES,
Signature · 1 line
2.4.11
#10 lore raw
In reply to Maciek Fijalkowski
Quoted 3 lines · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

I prefer the original form - ; isn't a full statement.

Quoted 20 lines
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +2 -1
index 9320d96..f20dfb8 100644
@@ -217,7 +217,8 @@ static void give_pages(struct receive_queue *rq, struct page *page)
 	struct page *end;
 
 	/* Find end of list, sew whole thing into vi->rq.pages. */
-	for (end = page; end->private; end = (struct page *)end->private);
+	for (end = page; end->private; end = (struct page *)end->private)
+		;
 	end->private = (unsigned long)rq->pages;
 	rq->pages = page;
 }
Signature · 1 line
2.4.11
maintainer Acked-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] Fix ERROR: code indent should use tabs where possible

In reply to Maciek Fijalkowski
Quoted 3 lines · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

But you really want to fix the subject. Make it less verbose drop upper case and add info about module. Something like:

virtio_net: coding style fix: use tabs for indent

Also, you misspelled Jason's email.

Quoted 19 lines
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/virtio_net.c +1 -1
index 6c8170c..5d71e9f 100644
@@ -2717,7 +2717,7 @@ static __init int virtio_net_driver_init(void)
 	if (ret)
 		goto err_dead;
 
-        ret = register_virtio_driver(&virtio_net_driver);
+	ret = register_virtio_driver(&virtio_net_driver);
 	if (ret)
 		goto err_virtio;
 	return 0;
Signature · 1 line
2.4.11
#11 lore raw
In reply to Michael S. Tsirkin
Quoted 18 lines · On Mon, 15 May 2017 05:58:05 +0300 "Michael S. Tsirkin" <[email protected]> wrote:
Quoted 3 lines · Maciek Fijalkowski

From: Maciej Fijalkowski <[email protected]>

I prefer the original form - ; isn't a full statement.

Quoted 11 lines
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/virtio_net.c +0 -0
index 9320d96..f20dfb8 100644
@@ -217,7 +217,8 @@ static void give_pages(struct receive_queue *rq, struct page *page)
 	struct page *end;
 
Quoted 4 lines

drivers/net/virtio_net.c static void give_pages(struct receive_queue *rq, struct page *page) · line 221

Quoted 4 lines
drivers/net/virtio_net.c +2 -1
 	/* Find end of list, sew whole thing into vi->rq.pages. */
-	for (end = page; end->private; end = (struct page *)end->private);
+	for (end = page; end->private; end = (struct page *)end->private)
+		;

FWIW, I generally like to put a comment on the next line to make it abundantly clear that there's nothing in the body of the loop, it's also more aesthetically pleasing than a semi-colon on the line by itself, ex. /* Nothing */; It's just too easy to misinterpret the loop otherwise, especially without gratuitous white space. Thanks,

Alex

Quoted 9 lines
Quoted 5 lines
drivers/net/virtio_net.c +0 -0
 	end->private = (unsigned long)rq->pages;
 	rq->pages = page;
 }
Signature · 1 line
2.4.11  

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

#12 lore raw

From: Alex Williamson

Quoted 1 line

Sent: 15 May 2017 04:21

...

Quoted 10 lines
Quoted 4 lines

drivers/net/virtio_net.c static void give_pages(struct receive_queue *rq, struct page *page) · line 221

Quoted 4 lines
drivers/net/virtio_net.c +2 -1
 	/* Find end of list, sew whole thing into vi->rq.pages. */
-	for (end = page; end->private; end = (struct page *)end->private);
+	for (end = page; end->private; end = (struct page *)end->private)
+		;

FWIW, I generally like to put a comment on the next line to make it abundantly clear that there's nothing in the body of the loop, it's also more aesthetically pleasing than a semi-colon on the line by itself, ex. /* Nothing */; It's just too easy to misinterpret the loop otherwise, especially without gratuitous white space. Thanks,

My preference is to put 'continue;' on a line by itself. Or even move the termination condition into the loop:

	for (end = page;; end = (struct page *)end->private)
		if (!end->private)
			break;

(oh, is that cast needed??)

David

#13 lore raw
In reply to Alex Williamson

From: Alex Williamson

Quoted 1 line

Sent: 15 May 2017 04:21

...

Quoted 10 lines
Quoted 4 lines

drivers/net/virtio_net.c static void give_pages(struct receive_queue *rq, struct page *page) · line 221

Quoted 4 lines
drivers/net/virtio_net.c +2 -1
 	/* Find end of list, sew whole thing into vi->rq.pages. */
-	for (end = page; end->private; end = (struct page *)end->private);
+	for (end = page; end->private; end = (struct page *)end->private)
+		;

FWIW, I generally like to put a comment on the next line to make it abundantly clear that there's nothing in the body of the loop, it's also more aesthetically pleasing than a semi-colon on the line by itself, ex. /* Nothing */; It's just too easy to misinterpret the loop otherwise, especially without gratuitous white space. Thanks,

My preference is to put 'continue;' on a line by itself. Or even move the termination condition into the loop:

	for (end = page;; end = (struct page *)end->private)
		if (!end->private)
			break;

(oh, is that cast needed??)

David