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


Groups > linux.kernel > #1491479 > unrolled thread

[PATCH] staging: vt6656: Add spaces around '+' operator

Started byMartin Alonso <martin.alonso@zoho.com>
First post2016-09-26 19:50 +0200
Last post2016-09-27 13:50 +0200
Articles 11 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: vt6656: Add spaces around '+' operator Martin Alonso <martin.alonso@zoho.com> - 2016-09-26 19:50 +0200
    Re: [PATCH] staging: vt6656: Add spaces around '+' operator Joe Perches <joe@perches.com> - 2016-09-26 20:10 +0200
      Re: [PATCH] staging: vt6656: Add spaces around '+' operator Martin Alonso <martin.alonso@zoho.com> - 2016-09-27 19:00 +0200
        [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 * Martin Alonso <martin.alonso@zoho.com> - 2016-09-27 20:00 +0200
          Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 * Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-28 09:50 +0200
            Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 * Malcolm Priestley <tvboxspy@gmail.com> - 2016-09-30 21:00 +0200
              Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 * Dan Carpenter <dan.carpenter@oracle.com> - 2016-09-30 21:40 +0200
          Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 * Greg KH <gregkh@linuxfoundation.org> - 2016-09-28 11:40 +0200
        [PATCH 1/2] staging: vt6656: Remove unused variable 'rx_sts' Martin Alonso <martin.alonso@zoho.com> - 2016-09-27 20:00 +0200
    Re: [PATCH] staging: vt6656: Add spaces around '+' operator Greg KH <gregkh@linuxfoundation.org> - 2016-09-27 13:20 +0200
      Re: [PATCH] staging: vt6656: Add spaces around '+' operator Martin Alonso <martin.alonso@zoho.com> - 2016-09-27 13:50 +0200

#1491479 — [PATCH] staging: vt6656: Add spaces around '+' operator

FromMartin Alonso <martin.alonso@zoho.com>
Date2016-09-26 19:50 +0200
Subject[PATCH] staging: vt6656: Add spaces around '+' operator
Message-ID<slIcp-6Mu-25@gated-at.bofh.it>
Fix coding style issue "spaces preferred around '+'
detected by checkpatch.pl in dpc.c file.

Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
---
 drivers/staging/vt6656/dpc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 6019aac..900cd5c 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -75,8 +75,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 
 	skb_data = (u8 *)skb->data;
 
-	rx_sts = skb_data+4;
-	rx_rate = skb_data+5;
+	rx_sts = skb_data + 4;
+	rx_rate = skb_data + 5;
 
 	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
 	/* -8TSF - 4RSR - 4SQ3 - ?Padding */
-- 
2.8.0

[toc] | [next] | [standalone]


#1491486

FromJoe Perches <joe@perches.com>
Date2016-09-26 20:10 +0200
Message-ID<slIvL-79b-5@gated-at.bofh.it>
In reply to#1491479
On Mon, 2016-09-26 at 14:48 -0300, Martin Alonso wrote:
> Fix coding style issue "spaces preferred around '+'
> detected by checkpatch.pl in dpc.c file.
[]
> diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
[]
> @@ -75,8 +75,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>  
> >  	skb_data = (u8 *)skb->data;
>  
> -	rx_sts = skb_data+4;
> -	rx_rate = skb_data+5;
> +	rx_sts = skb_data + 4;
> +	rx_rate = skb_data + 5;
>  
>  	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
>  	/* -8TSF - 4RSR - 4SQ3 - ?Padding */

You might as well make rx_rate u8 instead of u8 *
and change the uses of rx_rate.  rx_sts isn't used
anywhere at all and could be removed.

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


#1492043

FromMartin Alonso <martin.alonso@zoho.com>
Date2016-09-27 19:00 +0200
Message-ID<sm3TA-3vI-37@gated-at.bofh.it>
In reply to#1491486
On Mon, Sep 26, 2016 at 11:02:33AM -0700, Joe Perches wrote:
> On Mon, 2016-09-26 at 14:48 -0300, Martin Alonso wrote:
> > Fix coding style issue "spaces preferred around '+'
> > detected by checkpatch.pl in dpc.c file.
> []
> > diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> []
> > @@ -75,8 +75,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
> >  
> > >  	skb_data = (u8 *)skb->data;
> >  
> > -	rx_sts = skb_data+4;
> > -	rx_rate = skb_data+5;
> > +	rx_sts = skb_data + 4;
> > +	rx_rate = skb_data + 5;
> >  
> >  	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
> >  	/* -8TSF - 4RSR - 4SQ3 - ?Padding */
> 
> You might as well make rx_rate u8 instead of u8 *
> and change the uses of rx_rate.  rx_sts isn't used
> anywhere at all and could be removed.
> 
I'll send two patches to fix this issues.
Regards.

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


#1492076 — [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

FromMartin Alonso <martin.alonso@zoho.com>
Date2016-09-27 20:00 +0200
Subject[PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *
Message-ID<sm4PD-441-9@gated-at.bofh.it>
In reply to#1492043
Change the type and uses of rx_rate.

Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
---
 drivers/staging/vt6656/dpc.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index 655f000..782b7d7 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 	__le64 *tsf_time;
 	u32 frame_size;
 	int ii, r;
-	u8 *rx_rate, *sq, *sq_3;
+	u8 rx_rate;
+	u8 *sq, *sq_3;
 	u32 wbk_status;
 	u8 *skb_data;
 	u16 *pay_load_len;
@@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 
 	skb_data = (u8 *)skb->data;
 
-	rx_rate = skb_data + 5;
+	rx_rate = *(skb_data + 5);
 
 	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
 	/* -8TSF - 4RSR - 4SQ3 - ?Padding */
@@ -96,7 +97,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 	sband = hw->wiphy->bands[hw->conf.chandef.chan->band];
 
 	for (r = RATE_1M; r < MAX_RATE; r++) {
-		if (*rx_rate == rate[r])
+		if (rx_rate == rate[r])
 			break;
 	}
 
@@ -110,7 +111,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 	}
 
 	if (ii == sband->n_bitrates) {
-		dev_dbg(&priv->usb->dev, "Wrong RxRate %x\n", *rx_rate);
+		dev_dbg(&priv->usb->dev, "Wrong RxRate %x\n", rx_rate);
 		return false;
 	}
 
-- 
2.8.0

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


#1492302 — Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-09-28 09:50 +0200
SubjectRe: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *
Message-ID<smhMR-3RU-11@gated-at.bofh.it>
In reply to#1492076
On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:
> Change the type and uses of rx_rate.
> 
> Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
> ---
>  drivers/staging/vt6656/dpc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> index 655f000..782b7d7 100644
> --- a/drivers/staging/vt6656/dpc.c
> +++ b/drivers/staging/vt6656/dpc.c
> @@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>  	__le64 *tsf_time;
>  	u32 frame_size;
>  	int ii, r;
> -	u8 *rx_rate, *sq, *sq_3;
> +	u8 rx_rate;
> +	u8 *sq, *sq_3;
>  	u32 wbk_status;
>  	u8 *skb_data;
>  	u16 *pay_load_len;
> @@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>  
>  	skb_data = (u8 *)skb->data;
>  
> -	rx_rate = skb_data + 5;
> +	rx_rate = *(skb_data + 5);

It occurs to me that we don't check that skb->len is large enough here.
We just assume it has at least 5 bytes.

TODO: vt6656: verify skb->len before using it.

regards,
dan carpenter

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


#1494236 — Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

FromMalcolm Priestley <tvboxspy@gmail.com>
Date2016-09-30 21:00 +0200
SubjectRe: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *
Message-ID<snbcl-5HB-9@gated-at.bofh.it>
In reply to#1492302
On 28/09/16 08:40, Dan Carpenter wrote:
> On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:
>> Change the type and uses of rx_rate.
>>
>> Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
>> ---
>>  drivers/staging/vt6656/dpc.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
>> index 655f000..782b7d7 100644
>> --- a/drivers/staging/vt6656/dpc.c
>> +++ b/drivers/staging/vt6656/dpc.c
>> @@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>>  	__le64 *tsf_time;
>>  	u32 frame_size;
>>  	int ii, r;
>> -	u8 *rx_rate, *sq, *sq_3;
>> +	u8 rx_rate;
>> +	u8 *sq, *sq_3;
>>  	u32 wbk_status;
>>  	u8 *skb_data;
>>  	u16 *pay_load_len;
>> @@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>>
>>  	skb_data = (u8 *)skb->data;
>>
>> -	rx_rate = skb_data + 5;
>> +	rx_rate = *(skb_data + 5);
>
> It occurs to me that we don't check that skb->len is large enough here.
> We just assume it has at least 5 bytes.
>
> TODO: vt6656: verify skb->len before using it.

skb->len is always set to the tail room then trimmed by this function.

Regards

Malcolm

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


#1494253 — Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-09-30 21:40 +0200
SubjectRe: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *
Message-ID<snbP3-6b5-17@gated-at.bofh.it>
In reply to#1494236
On Fri, Sep 30, 2016 at 07:53:00PM +0100, Malcolm Priestley wrote:
> On 28/09/16 08:40, Dan Carpenter wrote:
> >On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:
> >>Change the type and uses of rx_rate.
> >>
> >>Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
> >>---
> >> drivers/staging/vt6656/dpc.c | 9 +++++----
> >> 1 file changed, 5 insertions(+), 4 deletions(-)
> >>
> >>diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> >>index 655f000..782b7d7 100644
> >>--- a/drivers/staging/vt6656/dpc.c
> >>+++ b/drivers/staging/vt6656/dpc.c
> >>@@ -46,7 +46,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
> >> 	__le64 *tsf_time;
> >> 	u32 frame_size;
> >> 	int ii, r;
> >>-	u8 *rx_rate, *sq, *sq_3;
> >>+	u8 rx_rate;
> >>+	u8 *sq, *sq_3;
> >> 	u32 wbk_status;
> >> 	u8 *skb_data;
> >> 	u16 *pay_load_len;
> >>@@ -75,7 +76,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
> >>
> >> 	skb_data = (u8 *)skb->data;
> >>
> >>-	rx_rate = skb_data + 5;
> >>+	rx_rate = *(skb_data + 5);
> >
> >It occurs to me that we don't check that skb->len is large enough here.
> >We just assume it has at least 5 bytes.
> >
> >TODO: vt6656: verify skb->len before using it.
> 
> skb->len is always set to the tail room then trimmed by this function.
> 

We call skb_trim() after assuming it's at least 5 bytes so that doesn't
matter for this discussion?

regards,
dan carpenter

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


#1492477 — Re: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-09-28 11:40 +0200
SubjectRe: [PATCH 2/2] staging: vt6656: Make 'rx_rate' u8 instead of u8 *
Message-ID<smjvk-4WB-49@gated-at.bofh.it>
In reply to#1492076
On Tue, Sep 27, 2016 at 02:52:49PM -0300, Martin Alonso wrote:
> Change the type and uses of rx_rate.

That's totally vague and doesn't say why this patch is needed at all.

For all I can tell, it looks like you are changing the type for no good
reason...

Please fix this up and resend.

thanks,

greg k-h

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


#1492077 — [PATCH 1/2] staging: vt6656: Remove unused variable 'rx_sts'

FromMartin Alonso <martin.alonso@zoho.com>
Date2016-09-27 20:00 +0200
Subject[PATCH 1/2] staging: vt6656: Remove unused variable 'rx_sts'
Message-ID<sm4PD-441-5@gated-at.bofh.it>
In reply to#1492043
As suggested by Joe Perches, rx_sts is not
used anywhere and could be removed.

Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
---
 drivers/staging/vt6656/dpc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
index c352c70..655f000 100644
--- a/drivers/staging/vt6656/dpc.c
+++ b/drivers/staging/vt6656/dpc.c
@@ -46,7 +46,7 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 	__le64 *tsf_time;
 	u32 frame_size;
 	int ii, r;
-	u8 *rx_sts, *rx_rate, *sq, *sq_3;
+	u8 *rx_rate, *sq, *sq_3;
 	u32 wbk_status;
 	u8 *skb_data;
 	u16 *pay_load_len;
@@ -75,7 +75,6 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
 
 	skb_data = (u8 *)skb->data;
 
-	rx_sts = skb_data + 4;
 	rx_rate = skb_data + 5;
 
 	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
-- 
2.8.0

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


#1491820

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-09-27 13:20 +0200
Message-ID<slYAx-qw-3@gated-at.bofh.it>
In reply to#1491479
On Mon, Sep 26, 2016 at 02:48:24PM -0300, Martin Alonso wrote:
> Fix coding style issue "spaces preferred around '+'
> detected by checkpatch.pl in dpc.c file.
> 
> Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
> ---
>  drivers/staging/vt6656/dpc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> index 6019aac..900cd5c 100644
> --- a/drivers/staging/vt6656/dpc.c
> +++ b/drivers/staging/vt6656/dpc.c
> @@ -75,8 +75,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
>  
>  	skb_data = (u8 *)skb->data;
>  
> -	rx_sts = skb_data+4;
> -	rx_rate = skb_data+5;
> +	rx_sts = skb_data + 4;
> +	rx_rate = skb_data + 5;
>  
>  	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
>  	/* -8TSF - 4RSR - 4SQ3 - ?Padding */
> -- 
> 2.8.0
> 

Doesn't apply to my tree, did someone do this before you?  You are
working against linux-next, right?

thanks,

greg k-h

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


#1491842

FromMartin Alonso <martin.alonso@zoho.com>
Date2016-09-27 13:50 +0200
Message-ID<slZ3z-zK-3@gated-at.bofh.it>
In reply to#1491820
On Tue, Sep 27, 2016 at 01:10:04PM +0200, Greg KH wrote:
> On Mon, Sep 26, 2016 at 02:48:24PM -0300, Martin Alonso wrote:
> > Fix coding style issue "spaces preferred around '+'
> > detected by checkpatch.pl in dpc.c file.
> > 
> > Signed-off-by: Martin Alonso <martin.alonso@zoho.com>
> > ---
> >  drivers/staging/vt6656/dpc.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c
> > index 6019aac..900cd5c 100644
> > --- a/drivers/staging/vt6656/dpc.c
> > +++ b/drivers/staging/vt6656/dpc.c
> > @@ -75,8 +75,8 @@ int vnt_rx_data(struct vnt_private *priv, struct vnt_rcb *ptr_rcb,
> >  
> >  	skb_data = (u8 *)skb->data;
> >  
> > -	rx_sts = skb_data+4;
> > -	rx_rate = skb_data+5;
> > +	rx_sts = skb_data + 4;
> > +	rx_rate = skb_data + 5;
> >  
> >  	/* real Frame Size = USBframe_size -4WbkStatus - 4RxStatus */
> >  	/* -8TSF - 4RSR - 4SQ3 - ?Padding */
> > -- 
> > 2.8.0
> > 
> 
> Doesn't apply to my tree, did someone do this before you?  You are
> working against linux-next, right?
> 
> thanks,
> 
> greg k-h
I wasn't working against linux-next as i though.
Sorry for the annoyance.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web