From 34e12d69f7be405b8e0683e307b0433a54894a7a Mon Sep 17 00:00:00 2001 From: Stephen Date: Mon, 6 Mar 2023 13:06:13 +0800 Subject: [PATCH] extcon: extcon-pd-virtual: add vpd->irq_lock initialisation This fixes the follwing error. [ 22.309582] BUG: spinlock bad magic on CPU#4, irq/107-virtual/297 [ 22.309618] lock: 0xffff0000071cb2b8, .magic: 00000000, .owner: /-1, .owner_cpu: 0 [ 22.309633] CPU: 4 PID: 297 Comm: irq/107-virtual Not tainted 5.10.110-52-rockchip #52 [ 22.309636] Hardware name: Radxa ROCK 4C+ (DT) [ 22.309641] Call trace: [ 22.309652] dump_backtrace+0x0/0x1b4 [ 22.309656] show_stack+0x24/0x30 [ 22.309663] dump_stack_lvl+0xc8/0xf8 [ 22.309667] dump_stack+0x18/0x34 [ 22.309674] spin_bug+0x90/0xb4 [ 22.309678] do_raw_spin_lock+0x44/0xe0 [ 22.309684] _raw_spin_lock_irqsave+0x30/0x44 [ 22.309700] vpd_irq_disable+0x30/0x80 [extcon_pd_virtual] [ 22.309706] dp_det_irq_handler+0x4c/0x60 [extcon_pd_virtual] [ 22.309714] irq_thread_fn+0x38/0x80 [ 22.309717] irq_thread+0xec/0x198 [ 22.309723] kthread+0xf8/0x108 [ 22.309728] ret_from_fork+0x10/0x30 Signed-off-by: Stephen --- drivers/extcon/extcon-pd-virtual.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/extcon/extcon-pd-virtual.c b/drivers/extcon/extcon-pd-virtual.c index b186ea5eb2850..01014e6e508a7 100644 --- a/drivers/extcon/extcon-pd-virtual.c +++ b/drivers/extcon/extcon-pd-virtual.c @@ -342,6 +342,7 @@ static int vpd_extcon_probe(struct platform_device *pdev) } vpd_extcon_init(vpd); + spin_lock_init(&vpd->irq_lock); INIT_DELAYED_WORK(&vpd->irq_work, extcon_pd_delay_irq_work); vpd->irq=gpiod_to_irq(vpd->gpio_irq);