Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752100AbdGBUte (ORCPT ); Sun, 2 Jul 2017 16:49:34 -0400 Received: from mail-lf0-f46.google.com ([209.85.215.46]:35746 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751876AbdGBUta (ORCPT ); Sun, 2 Jul 2017 16:49:30 -0400 Subject: Re: [PATCH 1/1] staging: ks7010: Fix cast to restricted __le16 in ks_wlan_net.c To: Luc Van Oostenryck Cc: Wolfram Sang , Greg Kroah-Hartman , Linux Driver Project Developer List , devel@driverdev.osuosl.org, open list References: <1499005648-28914-1-git-send-email-janusz.lisiecki@gmail.com> <1499005648-28914-2-git-send-email-janusz.lisiecki@gmail.com> From: Janusz Lisiecki Message-ID: Date: Sun, 2 Jul 2017 22:49:43 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1079 Lines: 24 W dniu 2017-07-02 o 21:38, Luc Van Oostenryck pisze: > On Sun, Jul 2, 2017 at 4:27 PM, Janusz Lisiecki > wrote: >> This patch fixes the following Sparse warnings in ks_wlan_net.c: >> drivers/staging/ks7010/ks_wlan_net.c:1359:24: warning: cast to restricted __le16 >> Both sides of assignment are u16 so (as 'ap' is local_ap_t type and 'capability' member, >> have the same as local 'capabilities' type of u16) 'le16_to_cpu' is not needed > It could be that it's ap->capability's type that is wrong (not > annotated with __le16). > Isn't it? > > Is ap->capability supposed to hold a little-endian value or a native > order value? > > -- Luc As I see in ks_hostif.c all assignments to link_ap_info_t->capability threat this value as native order (i.e get_ap_information, get_current_ap). As this is not a structure which comes from HW we can do the way you suggested. Still, as all other places in code threats this as native order value I decided to change only one place than many other around to fix Sparse warning. Pozdrawiam, Janusz Lisiecki