2020-05-19 23:56:06

by Ryder Lee

[permalink] [raw]
Subject: [PATCH] mt76: fix kbuild test robot warnings

Fix the following warnings:

warning: comparison is always false/true due to limited range of data type [-Wtype-limits].
warning: variable 'msta' set but not used

Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
---
@felix, maybe fold this patch into the previous one (if it's not yet merged).
---
drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 4 ++--
drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 ++--
drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 2 +-
drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 2 +-
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 ---
6 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
index f8c0c957ca01..f40dc4374eee 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
@@ -468,7 +468,7 @@ void mt7603_mac_sta_poll(struct mt7603_dev *dev)
}

static struct mt76_wcid *
-mt7603_rx_get_wcid(struct mt7603_dev *dev, u8 idx, bool unicast)
+mt7603_rx_get_wcid(struct mt7603_dev *dev, u16 idx, bool unicast)
{
struct mt7603_sta *sta;
struct mt76_wcid *wcid;
@@ -1227,7 +1227,7 @@ void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data)
struct mt76_wcid *wcid;
__le32 *txs_data = data;
u32 txs;
- u8 wcidx;
+ u16 wcidx;
u8 pid;

txs = le32_to_cpu(txs_data[4]);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
index 7d65a3fb0c23..08b950386bc8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
@@ -56,7 +56,7 @@ static const struct mt7615_dfs_radar_spec jp_radar_specs = {
};

static struct mt76_wcid *mt7615_rx_get_wcid(struct mt7615_dev *dev,
- u8 idx, bool unicast)
+ u16 idx, bool unicast)
{
struct mt7615_sta *sta;
struct mt76_wcid *wcid;
@@ -1291,7 +1291,7 @@ static void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data)
struct mt76_phy *mphy = &dev->mt76.phy;
__le32 *txs_data = data;
u32 txs;
- u8 wcidx;
+ u16 wcidx;
u8 pid;

txs = le32_to_cpu(txs_data[0]);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 6ea210bd3f07..5adcc9fa842a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -242,7 +242,7 @@ mt76x02_wait_for_txrx_idle(struct mt76_dev *dev)
}

static inline struct mt76x02_sta *
-mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx)
+mt76x02_rx_get_sta(struct mt76_dev *dev, u16 idx)
{
struct mt76_wcid *wcid;

diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
index a5a3bcd30d6f..a824412d1b8b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
@@ -778,7 +778,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
int pad_len = 0, nstreams = dev->chainmask & 0xf;
s8 signal;
u8 pn_len;
- u8 wcid;
+ u16 wcid;
int len;

if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
index c70d17b2290c..e4c405130e60 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
@@ -14,7 +14,7 @@ struct mt76x02_tx_status {
u8 success:1;
u8 aggr:1;
u8 ack_req:1;
- u8 wcid;
+ u16 wcid;
u8 pktid;
u8 retry;
u16 rate;
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
index 95cd24f41f98..f81afcc51801 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
@@ -1836,15 +1836,12 @@ static u8
mt7915_mcu_sta_txbf_type(struct mt7915_phy *phy, struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
{
- struct mt7915_sta *msta;
u8 type = 0;

if (vif->type != NL80211_IFTYPE_STATION &&
vif->type != NL80211_IFTYPE_AP)
return 0;

- msta = (struct mt7915_sta *)sta->drv_priv;
-
if (sta->he_cap.has_he) {
struct ieee80211_he_cap_elem *pe;
const struct ieee80211_he_cap_elem *ve;
--
2.18.0


2020-05-20 06:11:17

by Felix Fietkau

[permalink] [raw]
Subject: Re: [PATCH] mt76: fix kbuild test robot warnings

On 2020-05-20 01:55, Ryder Lee wrote:
> Fix the following warnings:
>
> warning: comparison is always false/true due to limited range of data type [-Wtype-limits].
> warning: variable 'msta' set but not used
>
> Reported-by: kbuild test robot <[email protected]>
> Signed-off-by: Ryder Lee <[email protected]>
> ---
> @felix, maybe fold this patch into the previous one (if it's not yet merged).
The previous changes are in linux-next, so nothing can be folded in anymore.

> drivers/net/wireless/mediatek/mt76/mt7603/mac.c | 4 ++--
> drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 4 ++--
> drivers/net/wireless/mediatek/mt76/mt76x02.h | 2 +-
> drivers/net/wireless/mediatek/mt76/mt76x02_mac.c | 2 +-
> drivers/net/wireless/mediatek/mt76/mt76x02_mac.h | 2 +-
> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 ---
> 6 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> index f8c0c957ca01..f40dc4374eee 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7603/mac.c
> @@ -468,7 +468,7 @@ void mt7603_mac_sta_poll(struct mt7603_dev *dev)
> }
>
> static struct mt76_wcid *
> -mt7603_rx_get_wcid(struct mt7603_dev *dev, u8 idx, bool unicast)
> +mt7603_rx_get_wcid(struct mt7603_dev *dev, u16 idx, bool unicast)
> {
> struct mt7603_sta *sta;
> struct mt76_wcid *wcid;
> @@ -1227,7 +1227,7 @@ void mt7603_mac_add_txs(struct mt7603_dev *dev, void *data)
> struct mt76_wcid *wcid;
> __le32 *txs_data = data;
> u32 txs;
> - u8 wcidx;
> + u16 wcidx;
> u8 pid;
>
> txs = le32_to_cpu(txs_data[4]);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> index 7d65a3fb0c23..08b950386bc8 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c
> @@ -56,7 +56,7 @@ static const struct mt7615_dfs_radar_spec jp_radar_specs = {
> };
>
> static struct mt76_wcid *mt7615_rx_get_wcid(struct mt7615_dev *dev,
> - u8 idx, bool unicast)
> + u16 idx, bool unicast)
> {
> struct mt7615_sta *sta;
> struct mt76_wcid *wcid;
> @@ -1291,7 +1291,7 @@ static void mt7615_mac_add_txs(struct mt7615_dev *dev, void *data)
> struct mt76_phy *mphy = &dev->mt76.phy;
> __le32 *txs_data = data;
> u32 txs;
> - u8 wcidx;
> + u16 wcidx;
> u8 pid;
>
> txs = le32_to_cpu(txs_data[0]);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
> index 6ea210bd3f07..5adcc9fa842a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
> @@ -242,7 +242,7 @@ mt76x02_wait_for_txrx_idle(struct mt76_dev *dev)
> }
>
> static inline struct mt76x02_sta *
> -mt76x02_rx_get_sta(struct mt76_dev *dev, u8 idx)
> +mt76x02_rx_get_sta(struct mt76_dev *dev, u16 idx)
> {
> struct mt76_wcid *wcid;
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
> index a5a3bcd30d6f..a824412d1b8b 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.c
> @@ -778,7 +778,7 @@ int mt76x02_mac_process_rx(struct mt76x02_dev *dev, struct sk_buff *skb,
> int pad_len = 0, nstreams = dev->chainmask & 0xf;
> s8 signal;
> u8 pn_len;
> - u8 wcid;
> + u16 wcid;
> int len;
>
> if (!test_bit(MT76_STATE_RUNNING, &dev->mphy.state))
> diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
> index c70d17b2290c..e4c405130e60 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_mac.h
> @@ -14,7 +14,7 @@ struct mt76x02_tx_status {
> u8 success:1;
> u8 aggr:1;
> u8 ack_req:1;
> - u8 wcid;
> + u16 wcid;
> u8 pktid;
> u8 retry;
> u16 rate;
All of the changes above are wrong and only paper over a real bug, since
the chip limit of 128 entries for 76xx still needs to be checked.
I'm sending a fix for this, so please send a new patch with only the
change below.

> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 95cd24f41f98..f81afcc51801 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -1836,15 +1836,12 @@ static u8
> mt7915_mcu_sta_txbf_type(struct mt7915_phy *phy, struct ieee80211_vif *vif,
> struct ieee80211_sta *sta)
> {
> - struct mt7915_sta *msta;
> u8 type = 0;
>
> if (vif->type != NL80211_IFTYPE_STATION &&
> vif->type != NL80211_IFTYPE_AP)
> return 0;
>
> - msta = (struct mt7915_sta *)sta->drv_priv;
> -
> if (sta->he_cap.has_he) {
> struct ieee80211_he_cap_elem *pe;
> const struct ieee80211_he_cap_elem *ve;
>

Thanks,

- Felix