From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751814AbdCDGio (ORCPT ); Sat, 4 Mar 2017 01:38:44 -0500 Received: from smtprelay0009.hostedemail.com ([216.40.44.9]:37987 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750708AbdCDGin (ORCPT ); Sat, 4 Mar 2017 01:38:43 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:152:355:379:541:599:960:968:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:1981:2194:2199:2393:2559:2562:2691:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6119:7903:8603:10004:10400:10848:11026:11232:11473:11658:11914:12043:12296:12740:12895:13069:13095:13311:13357:13894:14659:14721:21067:21080:21433:30012:30054:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: front20_41694be48c652 X-Filterd-Recvd-Size: 2305 Message-ID: <1488609447.2179.47.camel@perches.com> Subject: Re: [PATCH] staging: ks7010: clean up code From: Joe Perches To: Ernestas Kulik , gregkh@linuxfoundation.org Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Date: Fri, 03 Mar 2017 22:37:27 -0800 In-Reply-To: <20170304062858.GA2120@gmail.com> References: <20170303205836.32557-1-ernestas.kulik@gmail.com> <1488590630.2179.41.camel@perches.com> <20170304062858.GA2120@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2017-03-04 at 08:28 +0200, Ernestas Kulik wrote: > On Fri, 2017-03-03 at 17:23-0800, Joe Perches wrote: > > > On Fri, 2017-03-03 at 22:58 +0200, Ernestas Kulik wrote: > > > > > This fixes type warnings generated by sparse, replaces instances of > > > ntohs() with be16_to_cpu() and removes unused fields in structs. > > > > There's no real need to convert ntohs to be16_to_cpu > > I noticed a patch that was merged that replaces calls to these with the > more “generic” be16_to_cpu(), but I can revert that. > > This kind of conversion also happened in SeaBIOS, but it’s not exactly > the same thing as here. > > > > diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c > > > > [] > > > > > > @@ -297,7 +297,8 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer, > > > hdr = (struct hostif_hdr *)buffer; > > > > > > DPRINTK(4, "size=%d\n", hdr->size); > > > - if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) { > > > + if (le16_to_cpu(hdr->event) < HIF_DATA_REQ || > > > + HIF_REQ_MAX < le16_to_cpu(hdr->event)) { > > > > > > > This isn't mentioned and doesn't match the commit message > > It is and it does, but the commit message is a bit vague. I’ll try to > expand it. Not really. struct hostif_hdr.event is declared at uint16_t and not as __le16 so I believe this is incorrect and actually introduces a sparse error.