From patchwork Wed Mar 20 18:24:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 781525 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E006CDB2 for ; Wed, 20 Mar 2024 18:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710959094; cv=none; b=Ewm1St5VIIdQbmlAJlFNEQ8t4kvXxQrGxzmiss9XnuPa9lR2mo33zq29bK8oxwraaCtgWB4yCYngC1R80r0KroPt/JEoAc70MFM4yNA5LFC8bQFD4R5Kd7RzLDah/VlSA91yGedk69mcEp+ZmGB45rszXAT+r7Spuf8Mu+l0dTg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710959094; c=relaxed/simple; bh=EdsIChZtlt3+f2B8MK1ZkqevOlxjM8SzjWHSpkXMwxs=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QtazeRVCZMpBqNYNT76JcC6kPD8u62w+w8DM1B72JxvVxy4d3x6qnRM5e7KV3iztbtkeQpKcCZfC31HmQiz04xgNbLO1su4dXoXTS/UVFuID7PG/R0COtci9HumK5hsGpSsEvKdmuMQ0obNv7SpG3DhW0oUF67PB4/EGlwNeKhE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AK6VPbC1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AK6VPbC1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93E94C43390 for ; Wed, 20 Mar 2024 18:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710959094; bh=EdsIChZtlt3+f2B8MK1ZkqevOlxjM8SzjWHSpkXMwxs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AK6VPbC1mPm8WxVf3GwN8VwE44Pow6lwHel/AkEc7HidMNwBhWCO7l6t0mSl4VVTp KZ4+wWs3MgEX5gtS99WtTd81pjjkuJXFnq4X67EQZ9PmPm5Td6PraEv7SV3je9xQnY ePygyfj90cB3wj8gzODNWV66YAWGS8VODG/jaPax00PrMxQP/B/SoFO5zLSAR/A0Ch ZSxpTbRFTLZSFv22Hv5mS2I8iMmEa9MmFC2H9sRJckhvq6pdH8h8fsQ5rTAf7YOcbW JRBc3uWbA7d4P/dXfr5OGFggj9sQNMUNwfadt6c9o8sFI69VGwoPkwyolLXkCMKQ4l NFDktBGvyhb7g== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 2/4] wifi: wcn36xx: buff_to_be(): fix sparse warnings Date: Wed, 20 Mar 2024 20:24:47 +0200 Message-Id: <20240320182449.3757215-3-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320182449.3757215-1-kvalo@kernel.org> References: <20240320182449.3757215-1-kvalo@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kalle Valo Sparse warns: drivers/net/wireless/ath/wcn36xx/txrx.c: note: in included file (through drivers/net/wireless/ath/wcn36xx/txrx.h): drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types) drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: warning: incorrect type in assignment (different base types) drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: expected unsigned int [usertype] drivers/net/wireless/ath/wcn36xx/wcn36xx.h:107:24: got restricted __be32 [usertype] Use void pointers and two separate variables to workaround the warning. Also now the callers don't need any casting. There's actually cpu_to_be32_array() available but decided to do minimal changes instead. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/wcn36xx/txrx.c | 4 ++-- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/txrx.c b/drivers/net/wireless/ath/wcn36xx/txrx.c index 0802ed728824..8826998797d6 100644 --- a/drivers/net/wireless/ath/wcn36xx/txrx.c +++ b/drivers/net/wireless/ath/wcn36xx/txrx.c @@ -318,7 +318,7 @@ int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb) memset(&status, 0, sizeof(status)); bd = (struct wcn36xx_rx_bd *)skb->data; - buff_to_be((u32 *)bd, sizeof(*bd)/sizeof(u32)); + buff_to_be(bd, sizeof(*bd)/sizeof(u32)); wcn36xx_dbg_dump(WCN36XX_DBG_RX_DUMP, "BD <<< ", (char *)bd, sizeof(struct wcn36xx_rx_bd)); @@ -692,7 +692,7 @@ int wcn36xx_start_tx(struct wcn36xx *wcn, /* MGMT and CTRL frames are handeld here*/ wcn36xx_set_tx_mgmt(&bd, wcn, &vif_priv, skb, bcast); - buff_to_be((u32 *)&bd, sizeof(bd)/sizeof(u32)); + buff_to_be(&bd, sizeof(bd)/sizeof(u32)); bd.tx_bd_sign = 0xbdbdbdbd; ret = wcn36xx_dxe_tx_frame(wcn, vif_priv, &bd, skb, is_low); diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index ff4a8e5d7209..bccc27de848d 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -100,11 +100,14 @@ enum wcn36xx_ampdu_state { #define RF_IRIS_WCN3660 0x3660 #define RF_IRIS_WCN3680 0x3680 -static inline void buff_to_be(u32 *buf, size_t len) +static inline void buff_to_be(void *buf, size_t len) { + __be32 *to = buf; + u32 *from = buf; int i; + for (i = 0; i < len; i++) - buf[i] = cpu_to_be32(buf[i]); + to[i] = cpu_to_be32(from[i]); } struct nv_data { From patchwork Wed Mar 20 18:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kalle Valo X-Patchwork-Id: 781524 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8C6576DD0A for ; Wed, 20 Mar 2024 18:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710959096; cv=none; b=ALI5rDMd/41dDcvRiB4jWqFNbdruku8QnduWHIxvij++n3PEzTvTdaDL+fDprmJpcj/tktga61bH8s8uUmrsKZaCe21xvht0ZQpq8WIO8opRRNKp4ajD11RCNh43t81NLY2NVSkzZUcbYelPXlFgVaa+OlFGyvad84nOq8sKsHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710959096; c=relaxed/simple; bh=MjWyDUC/nS4snXHHsGdZsklEOiCdmd1uzg7HZvh8mDE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=srYK3WIr3RtXMySMjuRkXoBHw1anhkAG7ZGQqi7bB8PPQE9w2FuBuxiRNn0NP3o5xJRJMQtwjUyW/M8REb7NFnWLKeZg43KckkY5XwP8t76l3gfmc1kDMzlXextq4mUuqC13JlA+6rl7x8d0dbd8gPmsTNXwlwtakyOjLbrDE8U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VvFbRt8h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VvFbRt8h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A19E3C433F1 for ; Wed, 20 Mar 2024 18:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710959096; bh=MjWyDUC/nS4snXHHsGdZsklEOiCdmd1uzg7HZvh8mDE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=VvFbRt8h1UaqH/hqkAxW8rrJtqCksQjEsyiPrwuK6ZVd556URRciN9uNnmrdWEeb7 EE7jtiHlWGidXxFqVjzVwNKHGvFf2DH++UBxz+SE8Nsvp1y1/UIQHS5aktLjzyYW0q AIWJctyg0U4j04o8qy+6p5j/VziVZgpnKcbHLn/V+TOjVt2SEY77g6q993Yd2koCVM PXv3PmTWcuJL5WoLW1acVcuJuvgBQJrT11hzOAlqdVNwKEemkoNgxpGo/nZydEojqe Ho27gXygwD61rmRvCyGjvQhwkVIWMEZS6Y0pnop/0/oJUw6e8ochi4NCFDb1+MKPBP VkoGK+JVLQJJg== From: Kalle Valo To: linux-wireless@vger.kernel.org Subject: [PATCH 4/4] wifi: wil6210: fix sparse warnings Date: Wed, 20 Mar 2024 20:24:49 +0200 Message-Id: <20240320182449.3757215-5-kvalo@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240320182449.3757215-1-kvalo@kernel.org> References: <20240320182449.3757215-1-kvalo@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Kalle Valo Sparse warns: drivers/net/wireless/ath/wil6210/fw.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h): drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures drivers/net/wireless/ath/wil6210/cfg80211.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h): drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures I decided to remove the combos field altogether and just do pointer arithmetic instead. Not pretty but I didn't want to waste too much time on an orphaned driver. Compile tested only. Signed-off-by: Kalle Valo --- drivers/net/wireless/ath/wil6210/cfg80211.c | 4 ++-- drivers/net/wireless/ath/wil6210/fw.h | 1 - drivers/net/wireless/ath/wil6210/fw_inc.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/cfg80211.c b/drivers/net/wireless/ath/wil6210/cfg80211.c index dbe4b3478f03..8993028709ec 100644 --- a/drivers/net/wireless/ath/wil6210/cfg80211.c +++ b/drivers/net/wireless/ath/wil6210/cfg80211.c @@ -2735,7 +2735,7 @@ int wil_cfg80211_iface_combinations_from_fw( return 0; } - combo = conc->combos; + combo = (const struct wil_fw_concurrency_combo *)(conc + 1); n_combos = le16_to_cpu(conc->n_combos); for (i = 0; i < n_combos; i++) { total_limits += combo->n_limits; @@ -2751,7 +2751,7 @@ int wil_cfg80211_iface_combinations_from_fw( return -ENOMEM; iface_limit = (struct ieee80211_iface_limit *)(iface_combinations + n_combos); - combo = conc->combos; + combo = (const struct wil_fw_concurrency_combo *)(conc + 1); for (i = 0; i < n_combos; i++) { iface_combinations[i].max_interfaces = combo->max_interfaces; iface_combinations[i].num_different_channels = diff --git a/drivers/net/wireless/ath/wil6210/fw.h b/drivers/net/wireless/ath/wil6210/fw.h index aa1620e0d24f..2079a90ec260 100644 --- a/drivers/net/wireless/ath/wil6210/fw.h +++ b/drivers/net/wireless/ath/wil6210/fw.h @@ -93,7 +93,6 @@ struct wil_fw_record_concurrency { /* type == wil_fw_type_comment */ /* number of concurrency combinations that follow */ __le16 n_combos; /* keep last - combinations, variable size by n_combos */ - struct wil_fw_concurrency_combo combos[]; } __packed; /* brd file info encoded inside a comment record */ diff --git a/drivers/net/wireless/ath/wil6210/fw_inc.c b/drivers/net/wireless/ath/wil6210/fw_inc.c index fbc84c03406b..c3c0b289dcf3 100644 --- a/drivers/net/wireless/ath/wil6210/fw_inc.c +++ b/drivers/net/wireless/ath/wil6210/fw_inc.c @@ -212,8 +212,8 @@ fw_handle_concurrency(struct wil6210_priv *wil, const void *data, } n_combos = le16_to_cpu(rec->n_combos); - remain = size - offsetof(struct wil_fw_record_concurrency, combos); - combo = rec->combos; + remain = size - sizeof(struct wil_fw_record_concurrency); + combo = (const struct wil_fw_concurrency_combo *)(rec + 1); for (i = 0; i < n_combos; i++) { if (remain < sizeof(*combo)) goto out_short;