All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] i40e: precedence bug in i40e_get_pfc_delay()
@ 2014-10-29 16:10 Dan Carpenter
  2014-10-29 16:40 ` Nelson, Shannon
  2014-10-29 20:01 ` Jeff Kirsher
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-10-29 16:10 UTC (permalink / raw)
  To: kernel-janitors

The ">>" operation has higher precedence than the "&" operation.  Also
the casting is not needed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is static checker work and I haven't tested it on real hardware.

diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
index 00bc0cd..db9f9d3 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
@@ -40,8 +40,8 @@ static void i40e_get_pfc_delay(struct i40e_hw *hw, u16 *delay)
 	u32 val;
 
 	val = rd32(hw, I40E_PRTDCB_GENC);
-	*delay = (u16)(val & I40E_PRTDCB_GENC_PFCLDA_MASK >>
-		       I40E_PRTDCB_GENC_PFCLDA_SHIFT);
+	*delay = (val & I40E_PRTDCB_GENC_PFCLDA_MASK) >>
+		       I40E_PRTDCB_GENC_PFCLDA_SHIFT;
 }
 
 /**

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

* RE: [patch] i40e: precedence bug in i40e_get_pfc_delay()
  2014-10-29 16:10 [patch] i40e: precedence bug in i40e_get_pfc_delay() Dan Carpenter
@ 2014-10-29 16:40 ` Nelson, Shannon
  2014-10-29 20:01 ` Jeff Kirsher
  1 sibling, 0 replies; 3+ messages in thread
From: Nelson, Shannon @ 2014-10-29 16:40 UTC (permalink / raw)
  To: kernel-janitors

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Wednesday, October 29, 2014 9:10 AM
> To: Kirsher, Jeffrey T; Nelson, Shannon
> Cc: Brandeburg, Jesse; Allan, Bruce W; Wyborny, Carolyn; Skidmore,
> Donald C; Rose, Gregory V; Vick, Matthew; Ronciak, John; Williams, Mitch
> A; Linux NICS; Joe Perches; e1000-devel@lists.sourceforge.net; kernel-
> janitors@vger.kernel.org
> Subject: [patch] i40e: precedence bug in i40e_get_pfc_delay()
> 
> The ">>" operation has higher precedence than the "&" operation.  Also
> the casting is not needed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is static checker work and I haven't tested it on real hardware.
> 
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
> b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
> index 00bc0cd..db9f9d3 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c
> @@ -40,8 +40,8 @@ static void i40e_get_pfc_delay(struct i40e_hw *hw, u16
> *delay)
>  	u32 val;
> 
>  	val = rd32(hw, I40E_PRTDCB_GENC);
> -	*delay = (u16)(val & I40E_PRTDCB_GENC_PFCLDA_MASK >>
> -		       I40E_PRTDCB_GENC_PFCLDA_SHIFT);
> +	*delay = (val & I40E_PRTDCB_GENC_PFCLDA_MASK) >>
> +		       I40E_PRTDCB_GENC_PFCLDA_SHIFT;
>  }
> 
>  /**

Thanks.  We had just recently caught this internally, as well.  We'll have Jeff add this to our tree.

sln



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

* Re: [patch] i40e: precedence bug in i40e_get_pfc_delay()
  2014-10-29 16:10 [patch] i40e: precedence bug in i40e_get_pfc_delay() Dan Carpenter
  2014-10-29 16:40 ` Nelson, Shannon
@ 2014-10-29 20:01 ` Jeff Kirsher
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff Kirsher @ 2014-10-29 20:01 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

On Wed, 2014-10-29 at 19:10 +0300, Dan Carpenter wrote:
> The ">>" operation has higher precedence than the "&" operation.  Also
> the casting is not needed.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is static checker work and I haven't tested it on real hardware.

As Shannon has already mentioned, we found this internally and I think
that I already have a patch in the queue to resolve this.  Thank you,
and if I find I am incorrect and we do not already have a patch
resolving this, I will add your patch to the queue.  Thank you Dan!

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-10-29 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-29 16:10 [patch] i40e: precedence bug in i40e_get_pfc_delay() Dan Carpenter
2014-10-29 16:40 ` Nelson, Shannon
2014-10-29 20:01 ` Jeff Kirsher

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.