Linux USB
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: jaswinder.singh@linaro.org
Cc: linux-usb@vger.kernel.org
Subject: [bug report] usb: gadget: add udc driver for max3420
Date: Wed, 8 Feb 2023 17:41:38 +0300	[thread overview]
Message-ID: <Y+O0oviHe2CogH3M@kili> (raw)

Hello Jassi Brar,

The patch 48ba02b2e2b1: "usb: gadget: add udc driver for max3420"
from Jan 21, 2020, leads to the following Smatch static checker
warning:

	drivers/usb/gadget/udc/max3420_udc.c:1307 max3420_remove()
	warn: sleeping in atomic context

drivers/usb/gadget/udc/max3420_udc.c
    1298 static void max3420_remove(struct spi_device *spi)
    1299 {
    1300         struct max3420_udc *udc = spi_get_drvdata(spi);
    1301         unsigned long flags;
    1302 
    1303         usb_del_gadget_udc(&udc->gadget);
    1304 
    1305         spin_lock_irqsave(&udc->lock, flags);
                 ^^^^^^^^^^^^^^^^^

    1306 
--> 1307         kthread_stop(udc->thread_task);
                 ^^^^^^^^^^^^
We can't call thread_stop() if we're holding a spin_lock because it
has a sleep while we wait_for_completion(&kthread->exited).

    1308 
    1309         spin_unlock_irqrestore(&udc->lock, flags);
    1310 }

Similar issue:

drivers/usb/gadget/udc/core.c:740 usb_gadget_disconnect() warn: sleeping in atomic context
max3420_vbus_handler() <- disables preempt
-> usb_udc_vbus_handler()
   -> usb_udc_connect_control()
      -> usb_gadget_disconnect()

regards,
dan carpenter

                 reply	other threads:[~2023-02-08 14:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Y+O0oviHe2CogH3M@kili \
    --to=error27@gmail.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=linux-usb@vger.kernel.org \
    /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