[PATCH v2 3/3] staging: wfx: replace u32 by __le32

Greg KH gregkh at linuxfoundation.org
Mon Nov 11 14:12:30 UTC 2019


On Mon, Nov 11, 2019 at 01:30:55PM +0000, Jules Irenge wrote:
> Replace u32 by __le32 to fix warning of cast from restricted __le32.
> Issue detected by sparse tool.
> 
> Signed-off-by: Jules Irenge <jbi.octave at gmail.com>
> ---
> v1 uses casting to fix the warnings
> v2 replace the declaration type of the variables
> 
>  drivers/staging/wfx/hif_api_mib.h | 48 +++++++++++++++----------------
>  1 file changed, 24 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/staging/wfx/hif_api_mib.h b/drivers/staging/wfx/hif_api_mib.h
> index 94b789ceb4ff..e0a67410add2 100644
> --- a/drivers/staging/wfx/hif_api_mib.h
> +++ b/drivers/staging/wfx/hif_api_mib.h
> @@ -295,31 +295,31 @@ struct hif_mib_stats_table {
>  } __packed;
>  
>  struct hif_mib_extended_count_table {
> -	u32   count_plcp_errors;
> -	u32   count_fcs_errors;
> -	u32   count_tx_packets;
> -	u32   count_rx_packets;
> -	u32   count_rx_packet_errors;
> -	u32   count_rx_decryption_failures;
> -	u32   count_rx_mic_failures;
> -	u32   count_rx_no_key_failures;
> -	u32   count_tx_multicast_frames;
> -	u32   count_tx_frames_success;
> -	u32   count_tx_frame_failures;
> -	u32   count_tx_frames_retried;
> -	u32   count_tx_frames_multi_retried;
> -	u32   count_rx_frame_duplicates;
> -	u32   count_rts_success;
> -	u32   count_rts_failures;
> -	u32   count_ack_failures;
> -	u32   count_rx_multicast_frames;
> -	u32   count_rx_frames_success;
> -	u32   count_rx_cmacicv_errors;
> -	u32   count_rx_cmac_replays;
> -	u32   count_rx_mgmt_ccmp_replays;
> +	__le32   count_plcp_errors;
> +	__le32   count_fcs_errors;
> +	__le32   count_tx_packets;
> +	__le32   count_rx_packets;
> +	__le32   count_rx_packet_errors;
> +	__le32   count_rx_decryption_failures;
> +	__le32   count_rx_mic_failures;
> +	__le32   count_rx_no_key_failures;
> +	__le32   count_tx_multicast_frames;
> +	__le32   count_tx_frames_success;
> +	__le32   count_tx_frame_failures;
> +	__le32   count_tx_frames_retried;
> +	__le32   count_tx_frames_multi_retried;
> +	__le32   count_rx_frame_duplicates;
> +	__le32   count_rts_success;
> +	__le32   count_rts_failures;
> +	__le32   count_rx_multicast_frames;
> +	__le32   count_rx_cmacicv_errors;
> +	__le32   count_rx_cmac_replays;
> +	__le32   count_rx_mgmt_ccmp_replays;
> +	__le32   count_rx_beacon;
> +	__le32   count_miss_beacon;
> +	__le32   count_ack_failures;
> +	__le32   count_rx_frames_success;
>  	u32   count_rx_bipmic_errors;
> -	u32   count_rx_beacon;
> -	u32   count_miss_beacon;
>  	u32   reserved[15];
>  } __packed;

Is this structure coming from the hardware directly?  If so, you just
messed up the layout by moving things around, which will break the
driver :(

thanks,

greg k-h


More information about the devel mailing list