public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
@ 2015-01-12 16:51 Emrys Bayliss
  2015-01-13  5:23 ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Emrys Bayliss @ 2015-01-12 16:51 UTC (permalink / raw)
  To: forest, gregkh, tvboxspy; +Cc: devel, linux-kernel, Emrys Bayliss

This patch fixes the following checkpatch.pl error:
rxtx.c:588: WARNING: else is not generally useful after a break or return

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
---
 drivers/staging/vt6656/rxtx.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ea5140a..0cce140 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -574,8 +574,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
 
 		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
 	}
-
-	return 0;
 }
 
 static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
-- 
2.2.1


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

* Re: [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-12 16:51 [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return Emrys Bayliss
@ 2015-01-13  5:23 ` Sudip Mukherjee
  2015-01-13  5:58   ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2015-01-13  5:23 UTC (permalink / raw)
  To: Emrys Bayliss; +Cc: forest, gregkh, tvboxspy, devel, linux-kernel

On Tue, Jan 13, 2015 at 03:51:36AM +1100, Emrys Bayliss wrote:
> This patch fixes the following checkpatch.pl error:
> rxtx.c:588: WARNING: else is not generally useful after a break or return

was the checkpatch error solved with this change? have you checked?

and the checkpatch is giving error at line 558 and not at 588.

> 
> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> ---
>  drivers/staging/vt6656/rxtx.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ea5140a..0cce140 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -574,8 +574,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>  
>  		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
>  	}
> -
> -	return 0;

any reason why this return was removed ?

sudip

>  }
>  
>  static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
> -- 
> 2.2.1
> 
> --
> 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/

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

* Re: [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13  5:23 ` Sudip Mukherjee
@ 2015-01-13  5:58   ` Greg KH
  2015-01-13  6:24     ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2015-01-13  5:58 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: Emrys Bayliss, forest, tvboxspy, devel, linux-kernel

On Tue, Jan 13, 2015 at 10:53:12AM +0530, Sudip Mukherjee wrote:
> On Tue, Jan 13, 2015 at 03:51:36AM +1100, Emrys Bayliss wrote:
> > This patch fixes the following checkpatch.pl error:
> > rxtx.c:588: WARNING: else is not generally useful after a break or return
> 
> was the checkpatch error solved with this change? have you checked?
> 
> and the checkpatch is giving error at line 558 and not at 588.
> 
> > 
> > Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> > ---
> >  drivers/staging/vt6656/rxtx.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> > index ea5140a..0cce140 100644
> > --- a/drivers/staging/vt6656/rxtx.c
> > +++ b/drivers/staging/vt6656/rxtx.c
> > @@ -574,8 +574,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
> >  
> >  		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
> >  	}
> > -
> > -	return 0;
> 
> any reason why this return was removed ?

Because it's not needed.

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

* Re: [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13  5:58   ` Greg KH
@ 2015-01-13  6:24     ` Sudip Mukherjee
  2015-01-13  6:48       ` Sudip Mukherjee
  0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2015-01-13  6:24 UTC (permalink / raw)
  To: Greg KH; +Cc: Emrys Bayliss, forest, tvboxspy, devel, linux-kernel

On Mon, Jan 12, 2015 at 09:58:17PM -0800, Greg KH wrote:
> On Tue, Jan 13, 2015 at 10:53:12AM +0530, Sudip Mukherjee wrote:
> > On Tue, Jan 13, 2015 at 03:51:36AM +1100, Emrys Bayliss wrote:
> > > This patch fixes the following checkpatch.pl error:
> > > rxtx.c:588: WARNING: else is not generally useful after a break or return
> > 
> > was the checkpatch error solved with this change? have you checked?
> > 
> > and the checkpatch is giving error at line 558 and not at 588.
> > 
> > > 
> > > Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> > > ---
> > >  drivers/staging/vt6656/rxtx.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> > > index ea5140a..0cce140 100644
> > > --- a/drivers/staging/vt6656/rxtx.c
> > > +++ b/drivers/staging/vt6656/rxtx.c
> > > @@ -574,8 +574,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
> > >  
> > >  		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
> > >  	}
> > > -
> > > -	return 0;
> > 
> > any reason why this return was removed ?
> 
> Because it's not needed.

yes, it is not needed. but the way Emrys Bayliss has changed the code, then we will get a compiler warning about no return statement.
the code becomes :

if (condition) {
	...
	return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);	
} else {
	...
	return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
}

I would have removed that return when the code becomes:

if (condition) {
	...
	return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
}
...
return vnt_rxtx_datahead_g(tx_context, &buf->data_head);


or am i wrong in this ?

sudip

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

* Re: [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13  6:24     ` Sudip Mukherjee
@ 2015-01-13  6:48       ` Sudip Mukherjee
  2015-01-13 10:59         ` Dan Carpenter
  0 siblings, 1 reply; 6+ messages in thread
From: Sudip Mukherjee @ 2015-01-13  6:48 UTC (permalink / raw)
  To: Greg KH; +Cc: Emrys Bayliss, forest, tvboxspy, devel, linux-kernel

On Tue, Jan 13, 2015 at 11:54:27AM +0530, Sudip Mukherjee wrote:
> On Mon, Jan 12, 2015 at 09:58:17PM -0800, Greg KH wrote:
> > On Tue, Jan 13, 2015 at 10:53:12AM +0530, Sudip Mukherjee wrote:
> > > 
> > > any reason why this return was removed ?
> > 
> > Because it's not needed.
> 
> yes, it is not needed. but the way Emrys Bayliss has changed the code, then we will get a compiler warning about no return statement.
i should have mentioned in my last mail that compiler will give waring if we compile with W=3 

sudip

> the code becomes :
> 

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

* Re: [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13  6:48       ` Sudip Mukherjee
@ 2015-01-13 10:59         ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2015-01-13 10:59 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg KH, tvboxspy, devel, Emrys Bayliss, forest, linux-kernel

On Tue, Jan 13, 2015 at 12:18:40PM +0530, Sudip Mukherjee wrote:
> On Tue, Jan 13, 2015 at 11:54:27AM +0530, Sudip Mukherjee wrote:
> > On Mon, Jan 12, 2015 at 09:58:17PM -0800, Greg KH wrote:
> > > On Tue, Jan 13, 2015 at 10:53:12AM +0530, Sudip Mukherjee wrote:
> > > > 
> > > > any reason why this return was removed ?
> > > 
> > > Because it's not needed.
> > 
> > yes, it is not needed. but the way Emrys Bayliss has changed the code, then we will get a compiler warning about no return statement.
> i should have mentioned in my last mail that compiler will give waring if we compile with W=3 
> 

1) Your compiler is crap.
2) You should ignore obviously incorrect warnings.

I'm using GCC 4.7.2 and it doesn't give a warning for this.  W=3 gives a
million other totally worthless warnings though.  W=3 is not useful.

regards,
dan carpenter


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

end of thread, other threads:[~2015-01-13 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-12 16:51 [PATCH v2] Staging: vt6656: Checkpatch fix: else after break or return Emrys Bayliss
2015-01-13  5:23 ` Sudip Mukherjee
2015-01-13  5:58   ` Greg KH
2015-01-13  6:24     ` Sudip Mukherjee
2015-01-13  6:48       ` Sudip Mukherjee
2015-01-13 10:59         ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox