Re: [PATCH] usbip: fix warning in vhci_hcd_probe/lockdep_init_map

From: Shuah Khan
Date: Thu Dec 08 2016 - 09:32:42 EST


On 12/07/2016 09:12 PM, fx IWATA NOBUO wrote:
> Dear Shuah,
>
>> I noticed that in many places sysfs_attr_init() is called before populating
>> the fields such as name etc. However, I don't think the order matters.
>>
>> sysfs_attr_init() doesn't depend on name or any other fields being set:
>>
>> #define sysfs_attr_init(attr) \
>> do { \
>> static struct lock_class_key __key; \
>> \
>> (attr)->key = &__key; \
>> } while (0)
>>
>> Are you concerned about something else?
>
> Yes.
>
> If the macro name is 'attr_set_key', I don't have any concern.
>
> The name is 'attr_init' so I think there's possibility that some other
> items in attr may initialized in future.
>
> Also I think 'initialize struct first, then set items' is idiomatic order.
>
> Best Regards,
>

I am seeing places where sysfs_attr_init() after setting the name as well.
As this is more of a better done this way - I will fix this in the next
release. It is more important to fix the lockdep warning.

thanks,
-- Shuah