2022-02-15 12:38:55

by Bo Jiao

[permalink] [raw]
Subject: [PATCH] mt76: mt7915: fix compiler warning

From: Bo Jiao <[email protected]>

fix warning: variable 'temp' set but not used and
cast from pointer to integer of different size

Fixes: 91eeaef2523f ("mt76: mt7915: add support for MT7986")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
---
- please fold this into previous commit.
---
drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
index fb72ab4..decf288 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
@@ -125,7 +125,7 @@ mt7986_wmac_adie_efuse_read(struct mt7915_dev *dev, u8 adie,
return ret;

ret = read_poll_timeout(mt76_wmac_spi_read, temp,
- !FIELD_GET(MT_ADIE_EFUSE_KICK_MASK, val),
+ !temp && !FIELD_GET(MT_ADIE_EFUSE_KICK_MASK, val),
USEC_PER_MSEC, 50 * USEC_PER_MSEC, false,
dev, adie, MT_ADIE_EFUSE2_CTRL, &val);
if (ret)
@@ -1126,9 +1126,9 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
struct mt7915_dev *dev;
struct mt76_dev *mdev;
int irq, ret;
- u64 chip_id;
+ u32 chip_id;

- chip_id = (u64)of_device_get_match_data(&pdev->dev);
+ chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev);

irq = platform_get_irq(pdev, 0);
if (irq < 0)
--
2.18.0


2022-02-16 06:48:24

by Macpaul Lin

[permalink] [raw]
Subject: Re: [PATCH] mt76: mt7915: fix compiler warning

On 2/15/22 5:08 PM, Bo Jiao wrote:
> From: Bo Jiao <[email protected]>
>
> fix warning: variable 'temp' set but not used and
> cast from pointer to integer of different size
>
> Fixes: 91eeaef2523f ("mt76: mt7915: add support for MT7986")
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Bo Jiao <[email protected]>
> ---
> - please fold this into previous commit.
> ---
> drivers/net/wireless/mediatek/mt76/mt7915/soc.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
> index fb72ab4..decf288 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/soc.c
> @@ -125,7 +125,7 @@ mt7986_wmac_adie_efuse_read(struct mt7915_dev *dev, u8 adie,
> return ret;
>
> ret = read_poll_timeout(mt76_wmac_spi_read, temp,
> - !FIELD_GET(MT_ADIE_EFUSE_KICK_MASK, val),
> + !temp && !FIELD_GET(MT_ADIE_EFUSE_KICK_MASK, val),
> USEC_PER_MSEC, 50 * USEC_PER_MSEC, false,
> dev, adie, MT_ADIE_EFUSE2_CTRL, &val);
> if (ret)
> @@ -1126,9 +1126,9 @@ static int mt7986_wmac_probe(struct platform_device *pdev)
> struct mt7915_dev *dev;
> struct mt76_dev *mdev;
> int irq, ret;
> - u64 chip_id;
> + u32 chip_id;
>
> - chip_id = (u64)of_device_get_match_data(&pdev->dev);
> + chip_id = (uintptr_t)of_device_get_match_data(&pdev->dev);
>
> irq = platform_get_irq(pdev, 0);
> if (irq < 0)
>

Reviewed-by: Macpaul Lin <[email protected]>

Regards,
Macpaul Lin