From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754651AbbDTIY6 (ORCPT ); Mon, 20 Apr 2015 04:24:58 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:43072 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754036AbbDTIY4 (ORCPT ); Mon, 20 Apr 2015 04:24:56 -0400 Date: Mon, 20 Apr 2015 11:24:41 +0300 From: Dan Carpenter To: Gaston Gonzalez Cc: gregkh@linuxfoundation.org, navyasri.tech@gmail.com, joe@perches.com, arnd@arndb.de, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8192u: ieee80211: Silence sparse warning Message-ID: <20150420082441.GU10964@mwanda> References: <1429476231-6197-1-git-send-email-gascoar@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1429476231-6197-1-git-send-email-gascoar@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 19, 2015 at 05:43:51PM -0300, Gaston Gonzalez wrote: > Silence the following sparse warning: > > drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:184:16: warning: cast to restricted __le16 > We have a tkip_mixing_phase2() function in net/mac80211/tkip.c. That's probably the better thing. > Signed-off-by: Gaston Gonzalez > --- > .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 22 +++++++++++----------- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c > index e815c81..efa6983 100644 > --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c > +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c > @@ -179,1 +179,1 @@ static inline u16 Mk16(u8 hi, u8 lo) > } > > > -static inline u16 Mk16_le(u16 *v) > +static inline u16 Mk16_le(__le16 *v) > { > return le16_to_cpu(*v); > } Mk16_le() is a bad function name and as we can see from tkip.c it just duplicates get_unaligned_le16(). Better to make TK void pointer instead of a u8 pointer (because it doesn't point to u8s so we have to cast it every time we use it). This is another trick I learned from tkip.c. regards, dan carpenter