Re: sparse problem with duplicate __iomem?

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

 



On 8/18/20 12:23 PM, Luc Van Oostenryck wrote:
> On Tue, Aug 18, 2020 at 11:09:52AM -0700, Randy Dunlap wrote:
>> Hi,
>>
>> On kernel 5.9-rc1, either i386 or x86_64 builds, I am seeing these
>> sparse warnings:
>>
>> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: warning: duplicate [noderef]
>> ../drivers/gpu/drm/ast/ast_cursor.c:256:26: CK: error: multiple address space given: __iomem & __iomem
>>
>> for this source line:
>>
>> 	u8 __iomem *dst, __iomem *sig;
>>
>>
>> Should one of those __iomem-s be removed?
> 
> I think so. It's a bit like writing
> 	int const *a, const *b;
> or
> 	int unsigned *a, unsigned *b;
> 
>> I.e., does "__iomem" apply to everything after it, up to the ending ';',
>> or just up to the next comma ','? 
> 
> The (simplified) syntax for declarations is:
> 	declaration:
> 		declaration-specifiers [init-declarator-list] ;
> 	init-declarator-list:
> 		init-declarator
> 		init-declarator-list , init-declarator
> 	init-declarator
> 		declarator
> 		declarator = initializer
> 	declarator:
> 		[pointer] direct-declarator
> 	pointer:
> 		* [type-qualifier-list]
> 		* [type-qualifier-list] pointer
> 	direct-declarator:
> 		identifier
> 		...
> 
> Essentially, attributes are type modifiers, some acting like
> qualifiers and others are more like specifiers. But qualifiers
> and specifiers are never allowed directly after the comma because
> they appertain to the declaration-specifier part of the declaration.
> So, yes, the first __iomem applies to the whole declaration and
> the second one should be removed.
> 
> But maybe it's not 100% clear and the best should be to use a
> separate declaration for each variable?

Yes, that was my patch plan. :)

Thanks for the explanation.

-- 
~Randy




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux