Search Linux Wireless

Re: [PATCH v3 4/4] rtw88: Fix Sparse warning for rtw8821c_hw_spec

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

 



Ping-Ke Shih <pkshih@xxxxxxxxxxx> writes:

>> -----Original Message-----
>> From: Kalle Valo <kvalo@xxxxxxxxxx>
>> Sent: Wednesday, June 8, 2022 3:45 PM
>> To: Ping-Ke Shih <pkshih@xxxxxxxxxxx>
>> Cc: Larry Finger <Larry.Finger@xxxxxxxxxxxx>; Nathan Chancellor
>> <nathan@xxxxxxxxxx>; Johannes Berg
>> <johannes@xxxxxxxxxxxxxxxx>; linux-wireless@xxxxxxxxxxxxxxx
>> Subject: Re: [PATCH v3 4/4] rtw88: Fix Sparse warning for rtw8821c_hw_spec
>> 
>> Ping-Ke Shih <pkshih@xxxxxxxxxxx> writes:
>> 
>> >
>> > The ch_param[3] is only used by 8821c, so it doesn't affect other devices.
>> > I will prepare a patch to fix it.
>> 
>> But why didn't the compiler catch this? Is there some evil cast
>> somewhere which removes the const? We should fix that as well (in a
>> separate patch).
>> 
>
> This is because we assign a const to .driver_data that is non-const kernel_ulong_t:
>
> static const struct pci_device_id rtw_8821ce_id_table[] = {
> 	{
> 		.driver_data = (kernel_ulong_t)&rtw8821c_hw_spec
> 	},
>
> When casting it back in pci_probe(), we need to add 'const' after Larry's patches:
>
> rtwdev->chip = (struct rtw_chip_info *)id->driver_data;

Yeah, that definitely needs to be const.

> I will prepare another patch to fix that.

Great, thanks!

-- 
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