[PATCH 2/2] mt76: fix build error implicit enumeration conversion

Nathan Chancellor nathan at kernel.org
Mon Jul 26 17:42:18 PDT 2021


On Sun, Jun 20, 2021 at 03:48:07PM +0800, sean.wang at mediatek.com wrote:
> From: Sean Wang <sean.wang at mediatek.com>
> 
> drivers/net/wireless/mediatek/mt76/mt7915/mcu.c:114:10: error: implicit
> conversion from enumeration type 'enum mt76_cipher_type' to different
> enumeration type 'enum mcu_cipher_type' [-Werror,-Wenum-conversion]
>                 return MT_CIPHER_NONE;
>                 ~~~~~~ ^~~~~~~~~~~~~~
> 
> drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:114:10: error: implicit
> conversion from enumeration type 'enum mt76_cipher_type' to different
> enumeration type 'enum mcu_cipher_type' [-Werror,-Wenum-conversion]
>                 return MT_CIPHER_NONE;
>                 ~~~~~~ ^~~~~~~~~~~~~~
> 
> Fixes: c368362c36d3 ("mt76: fix iv and CCMP header insertion")
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>

Reviewed-by: Nathan Chancellor <nathan at kernel.org>

It would be nice if this could be added to 5.14-rc at some point in the
cycle as this shows up in clang builds for allmodconfig for various
architectures and I still do not see it in -next.

> ---
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 4 ++--
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.h | 3 ++-
>  drivers/net/wireless/mediatek/mt76/mt7921/mcu.c | 4 ++--
>  drivers/net/wireless/mediatek/mt76/mt7921/mcu.h | 3 ++-
>  4 files changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 863aa18b3024..c2e537a9c1dc 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -111,7 +111,7 @@ mt7915_mcu_get_cipher(int cipher)
>  	case WLAN_CIPHER_SUITE_SMS4:
>  		return MCU_CIPHER_WAPI;
>  	default:
> -		return MT_CIPHER_NONE;
> +		return MCU_CIPHER_NONE;
>  	}
>  }
>  
> @@ -1201,7 +1201,7 @@ mt7915_mcu_sta_key_tlv(struct mt7915_sta *msta, struct sk_buff *skb,
>  		u8 cipher;
>  
>  		cipher = mt7915_mcu_get_cipher(key->cipher);
> -		if (cipher == MT_CIPHER_NONE)
> +		if (cipher == MCU_CIPHER_NONE)
>  			return -EOPNOTSUPP;
>  
>  		sec_key = &sec->key[0];
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> index edd3ba3a0c2d..5b9b425bd836 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.h
> @@ -1073,7 +1073,8 @@ enum {
>  };
>  
>  enum mcu_cipher_type {
> -	MCU_CIPHER_WEP40 = 1,
> +	MCU_CIPHER_NONE,
> +	MCU_CIPHER_WEP40,
>  	MCU_CIPHER_WEP104,
>  	MCU_CIPHER_WEP128,
>  	MCU_CIPHER_TKIP,
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> index c2c4dc196802..81633be09e90 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.c
> @@ -111,7 +111,7 @@ mt7921_mcu_get_cipher(int cipher)
>  	case WLAN_CIPHER_SUITE_SMS4:
>  		return MCU_CIPHER_WAPI;
>  	default:
> -		return MT_CIPHER_NONE;
> +		return MCU_CIPHER_NONE;
>  	}
>  }
>  
> @@ -619,7 +619,7 @@ mt7921_mcu_sta_key_tlv(struct mt7921_sta *msta, struct sk_buff *skb,
>  		u8 cipher;
>  
>  		cipher = mt7921_mcu_get_cipher(key->cipher);
> -		if (cipher == MT_CIPHER_NONE)
> +		if (cipher == MCU_CIPHER_NONE)
>  			return -EOPNOTSUPP;
>  
>  		sec_key = &sec->key[0];
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h
> index d76cf8f8dfdf..3334afd8aea9 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/mcu.h
> @@ -199,7 +199,8 @@ struct sta_rec_sec {
>  } __packed;
>  
>  enum mcu_cipher_type {
> -	MCU_CIPHER_WEP40 = 1,
> +	MCU_CIPHER_NONE,
> +	MCU_CIPHER_WEP40,
>  	MCU_CIPHER_WEP104,
>  	MCU_CIPHER_WEP128,
>  	MCU_CIPHER_TKIP,
> -- 
> 2.25.1



More information about the Linux-mediatek mailing list