drivers/usb/chipidea/core.c:657 ci_usb_role_switch_set() error: double unlocked 'ci->lock' (orig line 638)

From: kernel test robot
Date: Fri Aug 07 2020 - 06:07:14 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 86cfccb66937dd6cbf26ed619958b9e587e6a115
commit: 05559f10ed797b79f7fa47313682c48919a2b111 usb: chipidea: add role switch class support
date: 12 months ago
config: parisc-randconfig-m031-20200807 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

smatch warnings:
drivers/usb/chipidea/core.c:657 ci_usb_role_switch_set() error: double unlocked 'ci->lock' (orig line 638)

vim +657 drivers/usb/chipidea/core.c

615
616 static int ci_usb_role_switch_set(struct device *dev, enum usb_role role)
617 {
618 struct ci_hdrc *ci = dev_get_drvdata(dev);
619 struct ci_hdrc_cable *cable = NULL;
620 enum usb_role current_role = ci_role_to_usb_role(ci);
621 unsigned long flags;
622
623 if (current_role == role)
624 return 0;
625
626 pm_runtime_get_sync(ci->dev);
627 /* Stop current role */
628 spin_lock_irqsave(&ci->lock, flags);
629 if (current_role == USB_ROLE_DEVICE)
630 cable = &ci->platdata->vbus_extcon;
631 else if (current_role == USB_ROLE_HOST)
632 cable = &ci->platdata->id_extcon;
633
634 if (cable) {
635 cable->changed = true;
636 cable->connected = false;
637 ci_irq(ci->irq, ci);
> 638 spin_unlock_irqrestore(&ci->lock, flags);
639 if (ci->wq && role != USB_ROLE_NONE)
640 flush_workqueue(ci->wq);
641 spin_lock_irqsave(&ci->lock, flags);
642 }
643
644 cable = NULL;
645
646 /* Start target role */
647 if (role == USB_ROLE_DEVICE)
648 cable = &ci->platdata->vbus_extcon;
649 else if (role == USB_ROLE_HOST)
650 cable = &ci->platdata->id_extcon;
651
652 if (cable) {
653 cable->changed = true;
654 cable->connected = true;
655 ci_irq(ci->irq, ci);
656 }
> 657 spin_unlock_irqrestore(&ci->lock, flags);
658 pm_runtime_put_sync(ci->dev);
659
660 return 0;
661 }
662

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip