lkml.org 
[lkml]   [2016]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] usbip: fix warning in vhci_hcd_probe/lockdep_init_map
From
Date
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

\
 
 \ /
  Last update: 2016-12-08 15:33    [W:0.049 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site