diff options
author | Christian Lamparter <chunkeey@googlemail.com> | 2017-08-28 19:11:15 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-08-29 08:27:25 +0200 |
commit | aa75936544fafc830ac3cc03458b771f3048a50f (patch) | |
tree | f150ef01e700728161ad0c8cfffda0a5738e6657 | |
parent | 49ca2eff5758eb73cc906dbea74ce54b7c99e4d1 (diff) |
usb: core: usbport: fix "BUG: key not in .data" when lockdep is enabled
This patch fixes a splat that happens if CONFIG_DEBUG_LOCK_ALLOC
is enabled and the ledtrig_usbport is loaded. (on a device that
has some usb ports).
[ 60.695479] BUG: key c53f8420 not in .data!
[ 60.695521] ------------[ cut here ]------------
[ 60.698542] WARNING: CPU: 1 PID: 854 at kernel/locking/lockdep.c:3134 __kernfs_create_file+0x5c/0xc0
[ 60.703355] DEBUG_LOCKS_WARN_ON(1)
[ 60.712534] Modules linked in:
[ 60.944078] CPU: 1 PID: 854 Comm: S96led Not tainted 4.9.44 #0
[ 60.944329] Hardware name: Generic DT based system
[ 60.950106] [<c021585c>] (unwind_backtrace) from [<c0212150>] (show_stack+0x10/0x14)
[ 60.954878] [<c0212150>] (show_stack) from [<c03a2bc4>] (dump_stack+0x7c/0x9c)
[ 60.962772] [<c03a2bc4>] (dump_stack) from [<c021db34>] (__warn+0xbc/0xec)
[ 60.969799] [<c021db34>] (__warn) from [<c021db98>] (warn_slowpath_fmt+0x34/0x44)
[ 60.976656] [<c021db98>] (warn_slowpath_fmt)
[ 60.984210] [<c0320688>] (__kernfs_create_file)
[ 60.992712] [<c0320ef0>] (sysfs_add_file_mode_ns)
[ 61.002090] [<c0321044>] (sysfs_add_file) from
[ 61.010619] [<c0321094>] (sysfs_add_file_to_group)
[ 61.019263] [<bf24a47c>] (usbport_trig_add_usb_dev_ports [ledtrig_usbport])
[ 61.031002] [<c0430414>] (bus_for_each_dev)
[ 61.042106] [<c0497dc4>] (usb_for_each_dev)
[ 61.050375] [<bf24a2ac>] (usbport_trig_activate [ledtrig_usbport])
[ 61.060685] [<c04e1708>] (led_trigger_set) from [<c04e1834>]
[...]
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/core/ledtrig-usbport.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/core/ledtrig-usbport.c b/drivers/usb/core/ledtrig-usbport.c index 5e265882ad2a..1af877942110 100644 --- a/drivers/usb/core/ledtrig-usbport.c +++ b/drivers/usb/core/ledtrig-usbport.c @@ -205,6 +205,7 @@ static int usbport_trig_add_port(struct usbport_trig_data *usbport_data, } snprintf(port->port_name, len, "%s-port%d", hub_name, portnum); + sysfs_attr_init(&port->attr.attr); port->attr.attr.name = port->port_name; port->attr.attr.mode = S_IRUSR | S_IWUSR; port->attr.show = usbport_trig_port_show; |