usb: roles: Fix a false positive recursive locking complaint
Subsystems (2)
PATCH 1/1 usb: roles: Fix a false positive recursive locking complaint
Suppress the following lockdep complaint:
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator.
Cc Hans de Goede <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Heikki Krogerus <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Fixes fde0aa6c175a ("usb: common: Small class for USB role switches")
Signed-off-by Bart Van Assche <[email protected]>
--- drivers/usb/roles/class.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/roles/class.c +5 -1
@@ -21,6 +21,7 @@ static const struct class role_class = {struct usb_role_switch {struct device dev; +struct lock_class_key key;struct mutex lock;/* device lock*/ struct module *module;/* the module this device depends on */ enum usb_role role;
@@ -326,6 +327,8 @@ static void usb_role_switch_release(struct device *dev) {struct usb_role_switch *sw =to_role_switch (dev); +mutex_destroy (&sw->lock); +lockdep_unregister_key (&sw->key);kfree (sw); }
@@ -364,7 +367,8 @@ usb_role_switch_register(struct device *parent,if (!sw)return ERR_PTR (-ENOMEM ); -mutex_init (&sw->lock); +lockdep_register_key (&sw->key); +__mutex_init (&sw->lock,"usb_role_switch_desc::lock" , &sw->key); sw->allow_userspace_control = desc->allow_userspace_control; sw->usb2_port = desc->usb2_port;
Quoted 1 line · Bart Van Assche
Suppress the following lockdep complaint: [ ... ]
Please ignore this patch and instead take a look at the one that has been posted on the linux-usb mailing list.
Thanks,
Bart.