netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, Doug Berger <opendmb@gmail.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net 2/2] net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb()
Date: Tue, 3 Apr 2018 17:23:34 +0100	[thread overview]
Message-ID: <20180403162334.GI30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180402225856.4351-3-f.fainelli@gmail.com>

On Mon, Apr 02, 2018 at 03:58:56PM -0700, Florian Fainelli wrote:
> skb->protocol is a __be16 which we would be calling htons() against,
> while this is not wrong per-se as it correctly results in swapping the
> value on LE hosts, this still upsets sparse. Adopt a similar pattern to
> what other drivers do and just assign ip_ver to skb->protocol, and then
> use htons() against the different constants such that the compiler can
> resolve the values at build time.

This is completely bogus.  What sparse is complaining about is htons used
to convert from big-endian to host-endian.  Which is what ntohs is for.
IOW, instead of all that crap just

-		ip_ver = htons(skb->protocol);
+		ip_ver = ntohs(skb->protocol);

and be done with that.  Same in other drivers with the same problem.

  reply	other threads:[~2018-04-03 16:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 22:58 [PATCH net 0/2] net: Broadcom drivers sparse fixes Florian Fainelli
2018-04-02 22:58 ` [PATCH net 1/2] net: bcmgenet: Fix sparse warnings in bcmgenet_put_tx_csum() Florian Fainelli
2018-04-03 16:29   ` Al Viro
2018-04-03 16:33     ` David Miller
2018-04-03 16:45       ` Al Viro
2018-04-03 20:40         ` Florian Fainelli
2018-04-06 20:05   ` Sasha Levin
2018-04-02 22:58 ` [PATCH net 2/2] net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb() Florian Fainelli
2018-04-03 16:23   ` Al Viro [this message]
2018-04-06 20:05   ` Sasha Levin
2018-04-04 15:07 ` [PATCH net 0/2] net: Broadcom drivers sparse fixes 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=20180403162334.GI30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    /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).