Search Linux Wireless

Re: [PATCH iwlwifi-next] iwlwifi: fix 'arithmetic on a pointer to void' errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Bjoern A. Zeeb" <bz@xxxxxxxxxxx> writes:

> Compiling the code with clang on FreeBSD complains about:
>   arithmetic on a pointer to void is a GNU extension
>       [-Werror,-Wpointer-arith].
> Cast to (u8 *) for the arithmetic operation and then back to
> the requested type or apply () before casting to avoid errors
> and have a defined behaviour.
>
> Sponsored-by:  The FreeBSD Foundation
> Signed-off-by: Bjoern A. Zeeb <bz@xxxxxxxxxxx>

[...]

> -		range = range + range_size;
> +		range = (void *)((u8 *)range + range_size);

I think "(void *)" is not needed here.

>  static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
>  			     struct iwl_mvm_scan_params *params,
>  			     int type, int uid)
>  {
>  	struct iwl_scan_req_umac *cmd = mvm->scan_cmd;
>  	struct iwl_scan_umac_chan_param *chan_param;
>  	void *cmd_data = iwl_mvm_get_scan_req_umac_data(mvm);
> -	void *sec_part = cmd_data + sizeof(struct iwl_scan_channel_cfg_umac) *
> -		mvm->fw->ucode_capa.n_scan_channels;
> +	void *sec_part = (void *)((u8 *)cmd_data +
> +		sizeof(struct iwl_scan_channel_cfg_umac) *
> +		mvm->fw->ucode_capa.n_scan_channels);

Not needed here as well.

> @@ -151,28 +151,28 @@ static inline void iwl_pcie_tfd_set_tb(struct iwl_trans *trans, void *tfd,
>  static int iwl_pcie_txq_build_tfd(struct iwl_trans *trans, struct iwl_txq *txq,
>  				  dma_addr_t addr, u16 len, bool reset)
>  {
>  	void *tfd;
>  	u32 num_tbs;
>
> -	tfd = txq->tfds + trans->txqs.tfd.size * txq->write_ptr;
> +	tfd = (void *)((u8 *)txq->tfds + trans->txqs.tfd.size * txq->write_ptr);

And not here.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux