lkml.org 
[lkml]   [2018]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net 2/2] net: systemport: Fix sparse warnings in bcm_sysport_insert_tsb()
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.

\
 
 \ /
  Last update: 2018-04-03 18:23    [W:0.070 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site