From patchwork Mon May 11 15:49:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 215654 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F684C54E8E for ; Mon, 11 May 2020 15:50:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 494E2206D7 for ; Mon, 11 May 2020 15:50:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="gt4rOxA3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730684AbgEKPue (ORCPT ); Mon, 11 May 2020 11:50:34 -0400 Received: from mail-mw2nam12on2062.outbound.protection.outlook.com ([40.107.244.62]:17760 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730648AbgEKPub (ORCPT ); Mon, 11 May 2020 11:50:31 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nqb4b0a2psl1D3aT7R2hHB6AVCUOfdTqjqoMT4e9TXcwkQsGD2rv2oa5A0SyAr6t6w+PYzfakdWLFVdqc5up5GGjYkN6mG2M9FnosmtX82j/UDmzotY+29JJXuQPvsq9z3IkK2abqx16WgdPrfZRfYmaYQsjaXi+GBoD9FjyvgeneZqCP73J2r9gej60TSUJPIfFSSUBl3KrGMoNvBVq/oSRFE1lXRvcZE6wNyXb2PVbn/5hSKi+95QKIt6vPhnCJH3J0vEtuIUgWPuD4/m0SLeMKYVyNmc1IhrsD64Nkj8OFqZ7INlQc9RGlqz90mgPFC7CL50CquU5imcur9tjeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z4srQK29dX43wzsCF0du08S6OvPn/4KroWPMEV0cAqI=; b=GlbTfVoiRCL6U4m+ZeyoXYfgPDzMEg7vQ7MnfVxoRJcOL024vkBiyPHo7R4qdDIF49IUtCFZlCyBT+WufdRWMpCSX8/YRRNjZK+68JAk+58DnsasUmn4pwJEXfvTReR6dA6zZ8sjDSpp30AQbyqbkXodFRzUlKTkDymQiNHRqikdaO2SvUBSFCnmskj83pSlYUO5aJn9v1VgkZK/L+azFNTubJ2H6ONYWBabGN3dzuku5+3wu0tUj/khwjW7P1fXRKoZQGI0wNJxQXQeI6/1c/B222gfnjKVX7BnJOJE7yGy/k5XdeYEsNHpVIX/oPD+ljgmqGQzjzcvaBhdD+j8vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z4srQK29dX43wzsCF0du08S6OvPn/4KroWPMEV0cAqI=; b=gt4rOxA3MnZWw82fybematDgF6P0Q74dZfhELfg4yigmwRFdnFHWdCPQt/2/glOhjzOqSVBOs236s4bqQi5YInAhOV4tXIWFfC/zqwh19t+5ccW9LLoqkRZZf0AgXHTOG+FkzJM5WLByRYg8vHndjTgi3LhFXRfbbZhHmxAT0fs= Authentication-Results: driverdev.osuosl.org; dkim=none (message not signed) header.d=none; driverdev.osuosl.org; dmarc=none action=none header.from=silabs.com; Received: from MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) by MWHPR11MB1968.namprd11.prod.outlook.com (2603:10b6:300:113::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.26; Mon, 11 May 2020 15:50:16 +0000 Received: from MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da]) by MWHPR11MB1775.namprd11.prod.outlook.com ([fe80::e055:3e6d:ff4:56da%5]) with mapi id 15.20.2979.033; Mon, 11 May 2020 15:50:16 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 15/17] staging: wfx: fix endianness of the field 'num_tx_confs' Date: Mon, 11 May 2020 17:49:28 +0200 Message-Id: <20200511154930.190212-16-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200511154930.190212-1-Jerome.Pouiller@silabs.com> References: <20200511154930.190212-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SN6PR2101CA0026.namprd21.prod.outlook.com (2603:10b6:805:106::36) To MWHPR11MB1775.namprd11.prod.outlook.com (2603:10b6:300:10e::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pc-42.silabs.com (82.67.86.106) by SN6PR2101CA0026.namprd21.prod.outlook.com (2603:10b6:805:106::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.2 via Frontend Transport; Mon, 11 May 2020 15:50:14 +0000 X-Mailer: git-send-email 2.26.2 X-Originating-IP: [82.67.86.106] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e219ba86-6697-47bd-7b1b-08d7f5c2fffb X-MS-TrafficTypeDiagnostic: MWHPR11MB1968: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4125; X-Forefront-PRVS: 04004D94E2 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qFQr4vMjnFVJC1itz3HKfhIMZUR6jjmk8j38Cssw0umAMN/df6IgNXnQ/XDQ7e8B9si6YBSMXu8zGTGRyfHUtUe4YsvF0/Q5R19PhfnB4S2CEuKPxzLjBHZYr8odFxyzkF20fyYR5DhOTbwCVkaz+ZEu3seuly2tY8QeZou4qTljQJPNyen7SdnTeh0QReLTXUtcErqC3z5BpBPbQf9OhHUxfPPIu6/K8NzPRO5M3qGeZIiwEsCj8nw9v5hnh9hU3MkRDp98z+ng97d5sfrwXLSvmKQe2NZ6zoGIHxD3WH2ZHLF9QvHPUJ92M/AqnE6wTbXCwtqoOqbTCMkajxYIRYdoKy9SVsLA9VDALVmAQmSWhdqSd7OBiufzB11nRQ2WGnTP6jIaqB6JQ4XjxGhdyut6+H+zZ75t9/ipeNwQqyBscl4YhtuLXa+EdguLIHgt86aQy22U7+lpXpaMrGPLPNkuAogWNhNU/T9wwFysM5ckOZbWPBWAW+PBPUDuvPe6csNvaqBSh7u4O54+a4WUsw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1775.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(39850400004)(346002)(136003)(396003)(376002)(366004)(33430700001)(186003)(52116002)(86362001)(316002)(5660300002)(7696005)(6486002)(33440700001)(478600001)(54906003)(6666004)(4326008)(107886003)(66574014)(36756003)(16526019)(26005)(8936002)(956004)(2616005)(8676002)(1076003)(66476007)(66946007)(66556008)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: x6If8Oe++0PsdYNBs4DROztM9P5o/Al3ZDC4yF+/av2UrbfNyhnmwke5YOsY25UqG9FOQHK14sD+GXSfyWMe9DplUhQ+lJJUHUBNmWIBvbJC5YpnkHbLv9wckrxt0E1CZg4QHdL4EaoFjFqHCeZc1EAis6YbmP1vcGjvsUwn9SPXI4Vly8DyOBYprwUj+a4OUQ1TjaP56FqFnghWf5lDNA7DKv6Et86esPuMeRa/wgu5lJqQGUn/2wd/c09Q6oDGtuIfZ4QCBoE/7WLNJgk1Gsw8BUCzPlun2BTN9C8GnDJJMJ0JOQd4FQikx94JeGn43sJZrUmcCVN9UsIvyGQmVkKq54exwWkDnYVl/I4oOj4yrtpjnv5Z9jy587Khxkz7jdRyb8ZgSSbgi7S7/Mu9+YpYooLdx4ss/7QZ9w0EBbXX34Klf8EDHRry9gNSt25If4ZjgdrBdIbGw0+gfhM7YsJcl5qjKK7oZT1J+d1yB+0= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: e219ba86-6697-47bd-7b1b-08d7f5c2fffb X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2020 15:50:16.6194 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 529S+q03yB8wAxt7H8Wrz+TAOls2GKpyBGZgrXG9U5CLmwXTzNmNTuF/OOWQgnnJPSFr5qNSd8gdyxzLSLQbYA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB1968 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller The field 'num_tx_confs' from the struct hif_cnf_multi_transmit is a __le32. Sparse complains this field is not always correctly accessed: drivers/staging/wfx/hif_rx.c:82:9: warning: restricted __le32 degrades to integer drivers/staging/wfx/hif_rx.c:87:29: warning: restricted __le32 degrades to integer However, the value of num_tx_confs cannot be greater than 15. So, we only have to access to the least significant byte. It is finally easier to declare it as an array of bytes and only access to the first one. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 2 +- drivers/staging/wfx/hif_api_cmd.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 0355b1a1c4bb..574b1f553af3 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -103,7 +103,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) if (!(hif->id & HIF_ID_IS_INDICATION)) { (*is_cnf)++; if (hif->id == HIF_CNF_ID_MULTI_TRANSMIT) - release_count = le32_to_cpu(((struct hif_cnf_multi_transmit *)hif->body)->num_tx_confs); + release_count = ((struct hif_cnf_multi_transmit *)hif->body)->num_tx_confs; else release_count = 1; WARN(wdev->hif.tx_buffers_used < release_count, "corrupted buffer counter"); diff --git a/drivers/staging/wfx/hif_api_cmd.h b/drivers/staging/wfx/hif_api_cmd.h index d76722bff7ee..8c48477e8797 100644 --- a/drivers/staging/wfx/hif_api_cmd.h +++ b/drivers/staging/wfx/hif_api_cmd.h @@ -280,7 +280,8 @@ struct hif_cnf_tx { } __packed; struct hif_cnf_multi_transmit { - __le32 num_tx_confs; + u8 num_tx_confs; + u8 reserved[3]; struct hif_cnf_tx tx_conf_payload[]; } __packed;