linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Pawel Laszczak <pawell@cadence.com>
Cc: linux-usb@vger.kernel.org
Subject: [bug report] usb: cdns3: Add Cadence USB3 DRD Driver
Date: Tue, 24 Sep 2019 16:55:58 +0300	[thread overview]
Message-ID: <20190924135558.GA18359@mwanda> (raw)

Hello Pawel Laszczak,

The patch 7733f6c32e36: "usb: cdns3: Add Cadence USB3 DRD Driver"
from Aug 26, 2019, leads to the following static checker warning:

	drivers/usb/cdns3/ep0.c:335 cdns3_ep0_feature_handle_device()
	error: scheduling with locks held: 'spin_lock:lock'

drivers/usb/cdns3/ep0.c
   309  
   310                  priv_dev->u2_allowed = !!set;
   311                  break;
   312          case USB_DEVICE_LTM_ENABLE:
   313                  ret = -EINVAL;
   314                  break;
   315          case USB_DEVICE_TEST_MODE:
   316                  if (state != USB_STATE_CONFIGURED || speed > USB_SPEED_HIGH)
   317                          return -EINVAL;
   318  
   319                  tmode = le16_to_cpu(ctrl->wIndex);
   320  
   321                  if (!set || (tmode & 0xff) != 0)
   322                          return -EINVAL;
   323  
   324                  switch (tmode >> 8) {
   325                  case TEST_J:
   326                  case TEST_K:
   327                  case TEST_SE0_NAK:
   328                  case TEST_PACKET:
   329                          cdns3_ep0_complete_setup(priv_dev, 0, 1);
   330                          /**
   331                           *  Little delay to give the controller some time
   332                           * for sending status stage.
   333                           * This time should be less then 3ms.
   334                           */
   335                          usleep_range(1000, 2000);
                                ^^^^^^^^^^^^^^^^^^^^^^^^
This is called with locks held and IRQs disabled in
cdns3_device_thread_irq_handler().  The call tree is:

cdns3_device_thread_irq_handler()
  cdns3_check_ep0_interrupt_proceed()
    cdns3_ep0_setup_phase()
      cdns3_ep0_standard_request()
        cdns3_req_ep0_handle_feature()
          cdns3_ep0_feature_handle_device()

You would need to have certain debug config options enabled to see the
might_sleep() warnings and probably USB_DEVICE_TEST_MODE isn't used
very often.

   336                          cdns3_set_register_bit(&priv_dev->regs->usb_cmd,
   337                                                 USB_CMD_STMODE |
   338                                                 USB_STS_TMODE_SEL(tmode - 1));
   339                          break;
   340                  default:
   341                          ret = -EINVAL;
   342                  }
   343                  break;
   344          default:
   345                  ret = -EINVAL;
   346          }

regards,
dan carpenter

             reply	other threads:[~2019-09-24 13:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 13:55 Dan Carpenter [this message]
2019-09-25  4:11 ` [bug report] usb: cdns3: Add Cadence USB3 DRD Driver Pawel Laszczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190924135558.GA18359@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=pawell@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).