Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754811AbdFWWlW (ORCPT ); Fri, 23 Jun 2017 18:41:22 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:32957 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170AbdFWWlU (ORCPT ); Fri, 23 Jun 2017 18:41:20 -0400 MIME-Version: 1.0 In-Reply-To: <1497607507-2531-1-git-send-email-jayad@cdac.in> References: <1497607507-2531-1-git-send-email-jayad@cdac.in> From: Frans Klaver Date: Sat, 24 Jun 2017 00:41:18 +0200 Message-ID: Subject: Re: [PATCH] Staging: wlan-ng: hfa384x_usb: Fixed sparse warning cast to restricted __le16 To: Jaya Durga Cc: Greg KH , sergio.paracuellos@gmail.com, adrien.descamps@gmail.com, devel@driverdev.osuosl.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1262 Lines: 31 On Fri, Jun 16, 2017 at 12:05 PM, Jaya Durga wrote: > when building with make C=1 CF=-D__CHECK_ENDIAN__ > > drivers/staging/wlan-ng/hfa384x_usb.c:3383:36: warning: cast to restricted __le16 > > fixed by using the le16_to_cpus function. > > Signed-off-by: Jaya Durga > --- > drivers/staging/wlan-ng/hfa384x_usb.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c > index a812e55..0e95e45 100644 > --- a/drivers/staging/wlan-ng/hfa384x_usb.c > +++ b/drivers/staging/wlan-ng/hfa384x_usb.c > @@ -3380,7 +3380,7 @@ static void hfa384x_usbin_rx(struct wlandevice *wlandev, struct sk_buff *skb) > u16 fc; > > /* Byte order convert once up front. */ > - usbin->rxfrm.desc.status = le16_to_cpu(usbin->rxfrm.desc.status); > + le16_to_cpus(&usbin->rxfrm.desc.status); Why is a cpu ordered value stored into a field that is documented to be little endian? When this happens we can't rely on this variable being little endian, can we? With the way things are now, at least it's flagged by some tool. Come this patch, it won't be. I don't think this patch fixes anything; it just tells sparse to shut up. Frans