netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Steve Glendinning <steve.glendinning@shawell.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 4/5] smsc95xx: fix smsc_crc return type
Date: Fri, 30 Nov 2012 07:59:59 -0800	[thread overview]
Message-ID: <1354291199.11903.22.camel@joe-AO722> (raw)
In-Reply-To: <1354290952-27109-5-git-send-email-steve.glendinning@shawell.net>

On Fri, 2012-11-30 at 15:55 +0000, Steve Glendinning wrote:
> This patch fixes a bug introduced in bbd9f9e which could prevent
> some wakeups from working correctly if multiple wol options were
> selected.
> 
> This helper function calculates a 16-bit crc and shifts it into
> either the high or low 16 bits of a u32 so the caller can or it
> directly into place.  The function previously had a u16 return
> type so would always have returned zero when filter was odd.
> 
> Signed-off-by: Steve Glendinning <steve.glendinning@shawell.net>
> Reported-by: Bjorn Mork <bjorn@mork.no>
> Cc: Joe Perches <joe@perches.com>
> ---
>  drivers/net/usb/smsc95xx.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
> index 064df1a..b9eb490 100644
> --- a/drivers/net/usb/smsc95xx.c
> +++ b/drivers/net/usb/smsc95xx.c
> @@ -1074,9 +1074,10 @@ static void smsc95xx_unbind(struct usbnet *dev, struct usb_interface *intf)
>  	}
>  }
>  
> -static u16 smsc_crc(const u8 *buffer, size_t len, int filter)
> +static u32 smsc_crc(const u8 *buffer, size_t len, int filter)
>  {
> -	return bitrev16(crc16(0xFFFF, buffer, len)) << ((filter % 2) * 16);
> +	u32 crc = bitrev16(crc16(0xFFFF, buffer, len));
> +	return crc << ((filter % 2) * 16);
>  }
>  
>  static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 mask)

Having filter as an argument to this function really
just confuses things.

The shift should be done when the result is or'd onto the
control variable.

  reply	other threads:[~2012-11-30 16:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30 15:55 [PATCH 0/5] smsc95xx enhancements Steve Glendinning
2012-11-30 15:55 ` [PATCH 1/5] smsc95xx: fix suspend buffer overflow Steve Glendinning
2012-11-30 16:03   ` Joe Perches
2012-11-30 15:55 ` [PATCH 2/5] smsc95xx: fix error handling in suspend failure case Steve Glendinning
2012-11-30 15:55 ` [PATCH 3/5] smsc95xx: don't enable remote wakeup directly Steve Glendinning
2012-11-30 15:55 ` [PATCH 4/5] smsc95xx: fix smsc_crc return type Steve Glendinning
2012-11-30 15:59   ` Joe Perches [this message]
2012-11-30 15:55 ` [PATCH 5/5] smsc95xx: expand check_ macros Steve Glendinning
2012-12-03 10:41   ` David Laight
2012-12-10  9:16     ` Steve Glendinning
2012-11-30 17:28 ` [PATCH 0/5] smsc95xx enhancements David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1354291199.11903.22.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=netdev@vger.kernel.org \
    --cc=steve.glendinning@shawell.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).