All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
@ 2015-01-11 16:19 Emrys Bayliss
  2015-01-11 16:42 ` Joe Perches
  0 siblings, 1 reply; 8+ messages in thread
From: Emrys Bayliss @ 2015-01-11 16:19 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 | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ea5140a..cc34704 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -553,8 +553,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
 			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
 
 		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
-
-		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
 	} else {
 		struct vnt_cts *buf = &head->cts_g;
 		/* Get SignalField,ServiceField,Length */
@@ -571,11 +569,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
 			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
 
 		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
-
-		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
 	}
 
-	return 0;
+	return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
 }
 
 static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
-- 
2.2.1


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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-11 16:19 [PATCH] Staging: vt6656: Checkpatch fix: else after break or return Emrys Bayliss
@ 2015-01-11 16:42 ` Joe Perches
  2015-01-11 21:30   ` Malcolm Priestley
  0 siblings, 1 reply; 8+ messages in thread
From: Joe Perches @ 2015-01-11 16:42 UTC (permalink / raw)
  To: Emrys Bayliss; +Cc: forest, gregkh, tvboxspy, devel, linux-kernel

On Mon, 2015-01-12 at 03:19 +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
> 
> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> ---
>  drivers/staging/vt6656/rxtx.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ea5140a..cc34704 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -553,8 +553,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>  			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>  
>  		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
> -
> -		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>  	} else {
>  		struct vnt_cts *buf = &head->cts_g;
>  		/* Get SignalField,ServiceField,Length */
> @@ -571,11 +569,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>  			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>  
>  		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
> -
> -		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
>  	}
>  
> -	return 0;
> +	return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>  }
>  
>  static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,

This is not the same code.
Does this even compile?

For the second block, you've changed
return <foo>_g(...) to <foo>_g_fb(...).




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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-11 16:42 ` Joe Perches
@ 2015-01-11 21:30   ` Malcolm Priestley
  2015-01-11 23:38     ` Emrys Bayliss
  0 siblings, 1 reply; 8+ messages in thread
From: Malcolm Priestley @ 2015-01-11 21:30 UTC (permalink / raw)
  To: Joe Perches, Emrys Bayliss; +Cc: forest, gregkh, devel, linux-kernel



On 11/01/15 16:42, Joe Perches wrote:
> On Mon, 2015-01-12 at 03:19 +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
>>
>> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
>> ---
>>   drivers/staging/vt6656/rxtx.c | 6 +-----
>>   1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
>> index ea5140a..cc34704 100644
>> --- a/drivers/staging/vt6656/rxtx.c
>> +++ b/drivers/staging/vt6656/rxtx.c
>> @@ -553,8 +553,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>>   			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>>
>>   		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>> -
>> -		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>>   	} else {
>>   		struct vnt_cts *buf = &head->cts_g;
>>   		/* Get SignalField,ServiceField,Length */
>> @@ -571,11 +569,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>>   			cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>>
>>   		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>> -
>> -		return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
>>   	}
>>
>> -	return 0;
>> +	return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>>   }
>>
>>   static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
>
> This is not the same code.
> Does this even compile?
>
> For the second block, you've changed
> return <foo>_g(...) to <foo>_g_fb(...).
>
Yes, this is wrong and will cause CTS to fail.


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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-11 21:30   ` Malcolm Priestley
@ 2015-01-11 23:38     ` Emrys Bayliss
  0 siblings, 0 replies; 8+ messages in thread
From: Emrys Bayliss @ 2015-01-11 23:38 UTC (permalink / raw)
  To: Malcolm Priestley, Joe Perches; +Cc: forest, gregkh, devel, linux-kernel

This is a bungle please disregard it.

I will send it again with a 'ret' variable if that's okay (one that
has been properly proofed and compiles).

My apologies. Sorry for completely wasting your time by not
checking properly.

On 01/12/2015 08:30 AM, Malcolm Priestley wrote:
>
>
> On 11/01/15 16:42, Joe Perches wrote:
>> On Mon, 2015-01-12 at 03:19 +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
>>>
>>> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
>>> ---
>>>   drivers/staging/vt6656/rxtx.c | 6 +-----
>>>   1 file changed, 1 insertion(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
>>> index ea5140a..cc34704 100644
>>> --- a/drivers/staging/vt6656/rxtx.c
>>> +++ b/drivers/staging/vt6656/rxtx.c
>>> @@ -553,8 +553,6 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>>>               cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>>>
>>>           memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>>> -
>>> -        return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>>>       } else {
>>>           struct vnt_cts *buf = &head->cts_g;
>>>           /* Get SignalField,ServiceField,Length */
>>> @@ -571,11 +569,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>>>               cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
>>>
>>>           memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>>> -
>>> -        return vnt_rxtx_datahead_g(tx_context, &buf->data_head);
>>>       }
>>>
>>> -    return 0;
>>> +    return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
>>>   }
>>>
>>>   static u16 vnt_rxtx_rts(struct vnt_usb_send_context *tx_context,
>>
>> This is not the same code.
>> Does this even compile?
>>
>> For the second block, you've changed
>> return <foo>_g(...) to <foo>_g_fb(...).
>>
> Yes, this is wrong and will cause CTS to fail.
>
>


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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13 17:03 Emrys Bayliss
  2015-01-13 17:12 ` Joe Perches
  2015-01-13 17:14 ` Greg KH
@ 2015-01-13 17:15 ` Emrys Bayliss
  2 siblings, 0 replies; 8+ messages in thread
From: Emrys Bayliss @ 2015-01-13 17:15 UTC (permalink / raw)
  To: forest, gregkh, tvboxspy; +Cc: devel, linux-kernel

This was supposed to be a v3 patch. Resent.

On 01/14/2015 04:03 AM, Emrys Bayliss wrote:
> This patch fixes the following checkpatch.pl error:
> rxtx.c:558: WARNING: else is not generally useful after a break or return
>
> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> ---
> The else statement was replaced with a block to avoid the following
> compiler error:
> "warning: ISO C90 forbids mixed declarations and code"
> due to this declaration:
> struct vnt_cts *buf = &head->cts_g; (line 559)
>
> Is there a better way such as using head (a union) directly instead?
>
> The last patch I sent removed the return 0. Since this isn't related to
> the error in the title I left it for a separate patch.
>
>  drivers/staging/vt6656/rxtx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ea5140a..831a051 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -555,7 +555,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>  		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>  
>  		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
> -	} else {
> +	}
> +
> +	{
>  		struct vnt_cts *buf = &head->cts_g;
>  		/* Get SignalField,ServiceField,Length */
>  		vnt_get_phy_field(priv, cts_frame_len,


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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13 17:03 Emrys Bayliss
  2015-01-13 17:12 ` Joe Perches
@ 2015-01-13 17:14 ` Greg KH
  2015-01-13 17:15 ` Emrys Bayliss
  2 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2015-01-13 17:14 UTC (permalink / raw)
  To: Emrys Bayliss; +Cc: forest, tvboxspy, devel, linux-kernel

On Wed, Jan 14, 2015 at 04:03:24AM +1100, Emrys Bayliss wrote:
> This patch fixes the following checkpatch.pl error:
> rxtx.c:558: WARNING: else is not generally useful after a break or return
> 
> Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
> ---
> The else statement was replaced with a block to avoid the following
> compiler error:
> "warning: ISO C90 forbids mixed declarations and code"
> due to this declaration:
> struct vnt_cts *buf = &head->cts_g; (line 559)
> 
> Is there a better way such as using head (a union) directly instead?
> 
> The last patch I sent removed the return 0. Since this isn't related to
> the error in the title I left it for a separate patch.
> 
>  drivers/staging/vt6656/rxtx.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
> index ea5140a..831a051 100644
> --- a/drivers/staging/vt6656/rxtx.c
> +++ b/drivers/staging/vt6656/rxtx.c
> @@ -555,7 +555,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
>  		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
>  
>  		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
> -	} else {
> +	}
> +
> +	{
>  		struct vnt_cts *buf = &head->cts_g;
>  		/* Get SignalField,ServiceField,Length */
>  		vnt_get_phy_field(priv, cts_frame_len,

This doesn't look correct at all, please fix up properly.

greg k-h

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

* Re: [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
  2015-01-13 17:03 Emrys Bayliss
@ 2015-01-13 17:12 ` Joe Perches
  2015-01-13 17:14 ` Greg KH
  2015-01-13 17:15 ` Emrys Bayliss
  2 siblings, 0 replies; 8+ messages in thread
From: Joe Perches @ 2015-01-13 17:12 UTC (permalink / raw)
  To: Emrys Bayliss; +Cc: forest, gregkh, tvboxspy, devel, linux-kernel

On Wed, 2015-01-14 at 04:03 +1100, Emrys Bayliss wrote:
> This patch fixes the following checkpatch.pl error:
> rxtx.c:558: WARNING: else is not generally useful after a break or return

"not generally" does not mean always.

It's OK to ignore these messages too.



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

* [PATCH] Staging: vt6656: Checkpatch fix: else after break or return
@ 2015-01-13 17:03 Emrys Bayliss
  2015-01-13 17:12 ` Joe Perches
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Emrys Bayliss @ 2015-01-13 17:03 UTC (permalink / raw)
  To: forest, gregkh, tvboxspy, emrys; +Cc: devel, linux-kernel

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

Signed-off-by: Emrys Bayliss <emrys@paradise.net.nz>
---
The else statement was replaced with a block to avoid the following
compiler error:
"warning: ISO C90 forbids mixed declarations and code"
due to this declaration:
struct vnt_cts *buf = &head->cts_g; (line 559)

Is there a better way such as using head (a union) directly instead?

The last patch I sent removed the return 0. Since this isn't related to
the error in the title I left it for a separate patch.

 drivers/staging/vt6656/rxtx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
index ea5140a..831a051 100644
--- a/drivers/staging/vt6656/rxtx.c
+++ b/drivers/staging/vt6656/rxtx.c
@@ -555,7 +555,9 @@ static u16 vnt_fill_cts_head(struct vnt_usb_send_context *tx_context,
 		memcpy(buf->data.ra, priv->current_net_addr, ETH_ALEN);
 
 		return vnt_rxtx_datahead_g_fb(tx_context, &buf->data_head);
-	} else {
+	}
+
+	{
 		struct vnt_cts *buf = &head->cts_g;
 		/* Get SignalField,ServiceField,Length */
 		vnt_get_phy_field(priv, cts_frame_len,
-- 
2.2.1


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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-11 16:19 [PATCH] Staging: vt6656: Checkpatch fix: else after break or return Emrys Bayliss
2015-01-11 16:42 ` Joe Perches
2015-01-11 21:30   ` Malcolm Priestley
2015-01-11 23:38     ` Emrys Bayliss
2015-01-13 17:03 Emrys Bayliss
2015-01-13 17:12 ` Joe Perches
2015-01-13 17:14 ` Greg KH
2015-01-13 17:15 ` Emrys Bayliss

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.