This can fix below dump when the lock is accessed at host mode due to it is not initialized. root@imx6qdlsolo:~# cat /sys/kernel/debug/ci_hdrc.1/port_test [ 929.904518] INFO: trying to register non-static key. [ 929.909536] the code is fine but needs lockdep annotation. [ 929.915043] turning off the locking correctness validator. [ 929.920567] CPU: 0 PID: 687 Comm: cat Not tainted 4.9.0-rc1-00064-g903de10 #1155 [ 929.927987] Hardware name: Freescale i.MX6 Ultralite (Device Tree) [ 929.934189] Backtrace: [ 929.936719] [<c010c460>] (dump_backtrace) from [<c010c658>] (show_stack+0x18/0x1c) [ 929.944312] r7:de47a000[ 929.946690] r6:60000193 r5:00000000[ 929.950322] r4:c0e2346c [ 929.952883] [ 929.954413] [<c010c640>] (show_stack) from [<c03f5aa4>] (dump_stack+0xb4/0xe8) [ 929.961675] [<c03f59f0>] (dump_stack) from [<c016d73c>] (register_lock_class+0x4fc/0x56c) [ 929.969871] r10:c0e23564[ 929.972335] r9:de47be70 r8:c163f444[ 929.975967] r7:ddcd4024 r6:00000000[ 929.979598] r5:00000000 [ 929.982158] r4:00000000[ 929.984534] r3:00000001 [ 929.987092] [ 929.988622] [<c016d240>] (register_lock_class) from [<c0171340>] (__lock_acquire+0x80/0x10f0) [ 929.997166] r10:c0e23564[ 929.999632] r9:de47be70 r8:ddcd4024[ 930.003265] r7:c163f444 r6:ddec3c00[ 930.006898] r5:60000193 [ 930.009458] r4:00000000[ 930.011832] [ 930.013368] [<c01712c0>] (__lock_acquire) from [<c017276c>] (lock_acquire+0x74/0x94) [ 930.021129] r10:00000001[ 930.023594] r9:de47be70 r8:de47bf80[ 930.027225] r7:00000001 r6:00000001[ 930.030857] r5:60000193 [ 930.033417] r4:00000000[ 930.035791] [ 930.037329] [<c01726f8>] (lock_acquire) from [<c096c324>] (_raw_spin_lock_irqsave+0x40/0x54) [ 930.045787] r7:dddb3c80[ 930.048163] r6:c062a468 r5:20000113[ 930.051795] r4:ddcd4014 [ 930.054354] [ 930.055885] [<c096c2e4>] (_raw_spin_lock_irqsave) from [<c062a468>] (ci_port_test_show+0x2c/0x70) [ 930.064776] r6:ddd930c0[ 930.067153] r5:ddcd4010 r4:ddcd4014[ 930.070783] [ 930.072329] [<c062a43c>] (ci_port_test_show) from [<c0249084>] (seq_read+0x1ac/0x4f8) [ 930.080179] r9:de47be70[ 930.082555] r8:de47bf80 r7:dddb3c80[ 930.086188] r6:00000001 r5:00000000[ 930.089820] r4:ddd930c0 [ 930.092404] [<c0248ed8>] (seq_read) from [<c039ebdc>] (full_proxy_read+0x54/0x6c) [ 930.099907] r10:00000000[ 930.102372] r9:c0a6ad70 r8:de47bf80[ 930.106004] r7:00020000 r6:b6dd1000[ 930.109636] r5:dddb3c80 [ 930.112197] r4:c0248ed8[ 930.114572] [ 930.116110] [<c039eb88>] (full_proxy_read) from [<c021efd8>] (__vfs_read+0x34/0x118) [ 930.123872] r9:de47a000[ 930.126250] r8:c0107fc4 r7:00020000[ 930.129883] r6:de47bf80 r5:c039eb88[ 930.133515] r4:dddb3c80 [ 930.136091] [<c021efa4>] (__vfs_read) from [<c021ff10>] (vfs_read+0x8c/0x11c) [ 930.143247] r9:de47a000[ 930.145625] r8:c0107fc4 r7:de47bf80[ 930.149259] r6:b6dd1000 r5:dddb3c80[ 930.152891] r4:00020000 [ 930.155469] [<c021fe84>] (vfs_read) from [<c0220d8c>] (SyS_read+0x4c/0xa8) [ 930.162363] r8:c0107fc4[ 930.164741] r7:00020000 r6:b6dd1000[ 930.168373] r5:dddb3c80 r4:dddb3c80[ 930.172001] [ 930.173540] [<c0220d40>] (SyS_read) from [<c0107e20>] (ret_fast_syscall+0x0/0x1c) [ 930.181041] r7:00000003[ 930.183419] r6:b6dd1000 r5:00020000[ 930.187051] r4:00020000 [ 930.189611] mode = 0 Cc: <stable@xxxxxxxxxxxxxxx> #v4.1+ Signed-off-by: Peter Chen <peter.chen@xxxxxxx> --- drivers/usb/chipidea/core.c | 1 + drivers/usb/chipidea/udc.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index a7d2c68..c5e7f3d 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -873,6 +873,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) if (!ci) return -ENOMEM; + spin_lock_init(&ci->lock); ci->dev = dev; ci->platdata = dev_get_platdata(dev); ci->imx28_write_fix = !!(ci->platdata->flags & diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 1e0ffad..e7bd064 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1886,8 +1886,6 @@ static int udc_start(struct ci_hdrc *ci) struct usb_otg_caps *otg_caps = &ci->platdata->ci_otg_caps; int retval = 0; - spin_lock_init(&ci->lock); - ci->gadget.ops = &usb_gadget_ops; ci->gadget.speed = USB_SPEED_UNKNOWN; ci->gadget.max_speed = USB_SPEED_HIGH; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html