linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gianfar: correct the bad expression while writing bit-pattern
@ 2015-01-12  7:43 Sanjeev Sharma
  2015-01-12 14:12 ` Sergei Shtylyov
  2015-01-12 14:22 ` [PATCH] " Claudiu Manoil
  0 siblings, 2 replies; 8+ messages in thread
From: Sanjeev Sharma @ 2015-01-12  7:43 UTC (permalink / raw)
  To: davem
  Cc: claudiu.manoil, peter.senna, shemminger, netdev, linux-kernel,
	Sanjeev Sharma, Sanjeev Sharma

This patch correct the bad expression while writing the
bit-pattern from software's buffer to hardware registers.

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
---
 drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 3e1a9c1..1ccca72 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
 		return -EBUSY;
 
 	/* Fill regular entries */
-	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
+	for (; i < MAX_FILER_IDX - 1 && ( i < tab->fe[i].ctrl);
 	     i++)
 		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
 	/* Fill the rest with fall-troughs */
-- 
1.7.11.7


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

* Re: [PATCH] gianfar: correct the bad expression while writing bit-pattern
  2015-01-12  7:43 [PATCH] gianfar: correct the bad expression while writing bit-pattern Sanjeev Sharma
@ 2015-01-12 14:12 ` Sergei Shtylyov
  2015-01-13  5:28   ` [PATCH v2] " Sanjeev Sharma
  2015-01-12 14:22 ` [PATCH] " Claudiu Manoil
  1 sibling, 1 reply; 8+ messages in thread
From: Sergei Shtylyov @ 2015-01-12 14:12 UTC (permalink / raw)
  To: Sanjeev Sharma, davem
  Cc: claudiu.manoil, peter.senna, shemminger, netdev, linux-kernel

Hello.

On 1/12/2015 10:43 AM, Sanjeev Sharma wrote:

> This patch correct the bad expression while writing the
> bit-pattern from software's buffer to hardware registers.

> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
> ---
>   drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

> diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> index 3e1a9c1..1ccca72 100644
> --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
> +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> @@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
>   		return -EBUSY;
>
>   	/* Fill regular entries */
> -	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
> +	for (; i < MAX_FILER_IDX - 1 && ( i < tab->fe[i].ctrl);

    Inner parens not needed. And there shouldn't be space after (.

WBR, Sergei


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

* Re: [PATCH] gianfar: correct the bad expression while writing bit-pattern
  2015-01-12  7:43 [PATCH] gianfar: correct the bad expression while writing bit-pattern Sanjeev Sharma
  2015-01-12 14:12 ` Sergei Shtylyov
@ 2015-01-12 14:22 ` Claudiu Manoil
  2015-02-03  7:32   ` [PATCH v3] " Sanjeev Sharma
  1 sibling, 1 reply; 8+ messages in thread
From: Claudiu Manoil @ 2015-01-12 14:22 UTC (permalink / raw)
  To: Sanjeev Sharma; +Cc: davem, peter.senna, shemminger, netdev, linux-kernel

On 1/12/2015 9:43 AM, Sanjeev Sharma wrote:
> This patch correct the bad expression while writing the
> bit-pattern from software's buffer to hardware registers.
>
> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
> ---
>   drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> index 3e1a9c1..1ccca72 100644
> --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
> +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> @@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
>   		return -EBUSY;
>
>   	/* Fill regular entries */
> -	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
> +	for (; i < MAX_FILER_IDX - 1 && ( i < tab->fe[i].ctrl);
>   	     i++)

Why do you think 'i' can be compared with the 'ctrl' field?
Is the control field an index (provide proof if yes)?  I doubt it...

Thanks,
Claudiu


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

* [PATCH v2] gianfar: correct the bad expression while writing bit-pattern
  2015-01-12 14:12 ` Sergei Shtylyov
@ 2015-01-13  5:28   ` Sanjeev Sharma
  2015-01-13  6:01     ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Sanjeev Sharma @ 2015-01-13  5:28 UTC (permalink / raw)
  To: davem
  Cc: claudiu.manoil, peter.senna, shemminger, netdev, linux-kernel,
	Sanjeev Sharma, Sanjeev Sharma

This patch correct the bad expression while writing the
bit-pattern from software's buffer to hardware registers.

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
---
Changes in v2:
  - incorporated review comment as per Sergei. 

 drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 3e1a9c1..347d5ee 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
 		return -EBUSY;
 
 	/* Fill regular entries */
-	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
+	for (; i < MAX_FILER_IDX - 1 && i < tab->fe[i].ctrl);
 	     i++)
 		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
 	/* Fill the rest with fall-troughs */
-- 
1.7.11.7


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

* Re: [PATCH v2] gianfar: correct the bad expression while writing bit-pattern
  2015-01-13  5:28   ` [PATCH v2] " Sanjeev Sharma
@ 2015-01-13  6:01     ` Eric Dumazet
  2015-01-13  6:15       ` Eric Dumazet
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Dumazet @ 2015-01-13  6:01 UTC (permalink / raw)
  To: Sanjeev Sharma
  Cc: davem, claudiu.manoil, peter.senna, shemminger, netdev, linux-kernel

On Tue, 2015-01-13 at 10:58 +0530, Sanjeev Sharma wrote:
> This patch correct the bad expression while writing the
> bit-pattern from software's buffer to hardware registers.
> 
> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
> ---
> Changes in v2:
>   - incorporated review comment as per Sergei. 
> 
>  drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> index 3e1a9c1..347d5ee 100644
> --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
> +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> @@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
>  		return -EBUSY;
>  
>  	/* Fill regular entries */
> -	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
> +	for (; i < MAX_FILER_IDX - 1 && i < tab->fe[i].ctrl);
>  	     i++)
>  		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
>  	/* Fill the rest with fall-troughs */

This makes no sense. Have you tried to compile this ?



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

* Re: [PATCH v2] gianfar: correct the bad expression while writing bit-pattern
  2015-01-13  6:01     ` Eric Dumazet
@ 2015-01-13  6:15       ` Eric Dumazet
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Dumazet @ 2015-01-13  6:15 UTC (permalink / raw)
  To: Sanjeev Sharma
  Cc: davem, claudiu.manoil, peter.senna, shemminger, netdev, linux-kernel

On Mon, 2015-01-12 at 22:01 -0800, Eric Dumazet wrote:
> On Tue, 2015-01-13 at 10:58 +0530, Sanjeev Sharma wrote:
> > This patch correct the bad expression while writing the
> > bit-pattern from software's buffer to hardware registers.
> > 
> > Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
> > ---
> > Changes in v2:
> >   - incorporated review comment as per Sergei. 
> > 
> >  drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> > index 3e1a9c1..347d5ee 100644
> > --- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
> > +++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
> > @@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
> >  		return -EBUSY;
> >  
> >  	/* Fill regular entries */
> > -	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
> > +	for (; i < MAX_FILER_IDX - 1 && i < tab->fe[i].ctrl);
> >  	     i++)
> >  		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
> >  	/* Fill the rest with fall-troughs */
> 
> This makes no sense. Have you tried to compile this ?

I have no idea of what this code is trying to do, but most likely
author intent was to break loop when both ctrl and prop are 0 :

diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 3e1a9c1a67a9..fda12fb32ec7 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
 		return -EBUSY;
 
 	/* Fill regular entries */
-	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
+	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);
 	     i++)
 		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
 	/* Fill the rest with fall-troughs */



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

* [PATCH v3] gianfar: correct the bad expression while writing bit-pattern
  2015-01-12 14:22 ` [PATCH] " Claudiu Manoil
@ 2015-02-03  7:32   ` Sanjeev Sharma
  2015-02-04 21:55     ` David Miller
  0 siblings, 1 reply; 8+ messages in thread
From: Sanjeev Sharma @ 2015-02-03  7:32 UTC (permalink / raw)
  To: claudiu.manoil
  Cc: davem, matei.pavaluca, netdev, linux-kernel, Sanjeev Sharma,
	Sanjeev Sharma

This patch correct the bad expression while writing the
bit-pattern from software's buffer to hardware registers.

Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
---
Changes in v3:
  - corrected the expression by introducing tab->fe[i].prop.

 drivers/net/ethernet/freescale/gianfar_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/gianfar_ethtool.c b/drivers/net/ethernet/freescale/gianfar_ethtool.c
index 3e1a9c1..fda12fb 100644
--- a/drivers/net/ethernet/freescale/gianfar_ethtool.c
+++ b/drivers/net/ethernet/freescale/gianfar_ethtool.c
@@ -1586,7 +1586,7 @@ static int gfar_write_filer_table(struct gfar_private *priv,
 		return -EBUSY;
 
 	/* Fill regular entries */
-	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].ctrl);
+	for (; i < MAX_FILER_IDX - 1 && (tab->fe[i].ctrl | tab->fe[i].prop);
 	     i++)
 		gfar_write_filer(priv, i, tab->fe[i].ctrl, tab->fe[i].prop);
 	/* Fill the rest with fall-troughs */
-- 
1.7.11.7


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

* Re: [PATCH v3] gianfar: correct the bad expression while writing bit-pattern
  2015-02-03  7:32   ` [PATCH v3] " Sanjeev Sharma
@ 2015-02-04 21:55     ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-02-04 21:55 UTC (permalink / raw)
  To: sanjeev_sharma; +Cc: claudiu.manoil, matei.pavaluca, netdev, linux-kernel

From: Sanjeev Sharma <sanjeev_sharma@mentor.com>
Date: Tue, 3 Feb 2015 13:02:02 +0530

> This patch correct the bad expression while writing the
> bit-pattern from software's buffer to hardware registers.
> 
> Signed-off-by: Sanjeev Sharma <Sanjeev_Sharma@mentor.com>
> ---
> Changes in v3:
>   - corrected the expression by introducing tab->fe[i].prop.

Applied, thanks.

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

end of thread, other threads:[~2015-02-04 21:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12  7:43 [PATCH] gianfar: correct the bad expression while writing bit-pattern Sanjeev Sharma
2015-01-12 14:12 ` Sergei Shtylyov
2015-01-13  5:28   ` [PATCH v2] " Sanjeev Sharma
2015-01-13  6:01     ` Eric Dumazet
2015-01-13  6:15       ` Eric Dumazet
2015-01-12 14:22 ` [PATCH] " Claudiu Manoil
2015-02-03  7:32   ` [PATCH v3] " Sanjeev Sharma
2015-02-04 21:55     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).