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


Groups > linux.kernel > #1641171 > unrolled thread

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

Started byMaciek Fijalkowski <macfij7@wp.pl>
First post2017-05-14 20:00 +0200
Last post2017-05-15 16:30 +0200
Articles 4 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/3] Fix ERROR: trailing statements should be on next line Maciek Fijalkowski <macfij7@wp.pl> - 2017-05-14 20:00 +0200
    Re: [PATCH 1/3] Fix ERROR: trailing statements should be on next line "Michael S. Tsirkin" <mst@redhat.com> - 2017-05-15 05:00 +0200
      Re: [PATCH 1/3] Fix ERROR: trailing statements should be on next  line Alex Williamson <alex.williamson@redhat.com> - 2017-05-15 05:30 +0200
        RE: [PATCH 1/3] Fix ERROR: trailing statements should be on next  line David Laight <David.Laight@ACULAB.COM> - 2017-05-15 16:30 +0200

#1641171 — [PATCH 1/3] Fix ERROR: trailing statements should be on next line

FromMaciek Fijalkowski <macfij7@wp.pl>
Date2017-05-14 20:00 +0200
Subject[PATCH 1/3] Fix ERROR: trailing statements should be on next line
Message-ID<tH5Ye-4E8-5@gated-at.bofh.it>
From: Maciej Fijalkowski <macfij7@wp.pl>

Signed-off-by: Maciej Fijalkowski <macfij7@wp.pl>
---
 drivers/net/virtio_net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 9320d96..f20dfb8 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -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;
 }
-- 
2.4.11

[toc] | [next] | [standalone]


#1641254

From"Michael S. Tsirkin" <mst@redhat.com>
Date2017-05-15 05:00 +0200
Message-ID<tHeoN-1YZ-7@gated-at.bofh.it>
In reply to#1641171
On Sun, May 14, 2017 at 07:51:28PM +0200, Maciek Fijalkowski wrote:
> From: Maciej Fijalkowski <macfij7@wp.pl>
> 
> Signed-off-by: Maciej Fijalkowski <macfij7@wp.pl>

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

> ---
>  drivers/net/virtio_net.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 9320d96..f20dfb8 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -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;
>  }
> -- 
> 2.4.11

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


#1641260 — Re: [PATCH 1/3] Fix ERROR: trailing statements should be on next line

FromAlex Williamson <alex.williamson@redhat.com>
Date2017-05-15 05:30 +0200
SubjectRe: [PATCH 1/3] Fix ERROR: trailing statements should be on next line
Message-ID<tHeRQ-2oS-1@gated-at.bofh.it>
In reply to#1641254
On Mon, 15 May 2017 05:58:05 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> On Sun, May 14, 2017 at 07:51:28PM +0200, Maciek Fijalkowski wrote:
> > From: Maciej Fijalkowski <macfij7@wp.pl>
> > 
> > Signed-off-by: Maciej Fijalkowski <macfij7@wp.pl>  
> 
> I prefer the original form - ; isn't a full statement.
> 
> > ---
> >  drivers/net/virtio_net.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index 9320d96..f20dfb8 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -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)
> > +		;

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


> >  	end->private = (unsigned long)rq->pages;
> >  	rq->pages = page;
> >  }
> > -- 
> > 2.4.11  
> _______________________________________________
> Virtualization mailing list
> Virtualization@lists.linux-foundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/virtualization

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


#1641742 — RE: [PATCH 1/3] Fix ERROR: trailing statements should be on next line

FromDavid Laight <David.Laight@ACULAB.COM>
Date2017-05-15 16:30 +0200
SubjectRE: [PATCH 1/3] Fix ERROR: trailing statements should be on next line
Message-ID<tHpay-Ra-19@gated-at.bofh.it>
In reply to#1641260
From: Alex Williamson
> Sent: 15 May 2017 04:21
...
> > >  	/* 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web