All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] ALSA: mixart: Use nonatomic PCM ops
@ 2020-11-18 13:52 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-11-18 13:52 UTC (permalink / raw)
  To: tiwai; +Cc: alsa-devel

[ This bug predates git but my email script just uses `git blame -w`.
  -dan ]

Hello Takashi Iwai,

The patch 8d3a8b5cb57d: "ALSA: mixart: Use nonatomic PCM ops" from
Sep 10, 2014, leads to the following static checker warning:

	sound/pci/mixart/mixart_core.c:73 get_msg()
	warn: called with lock held.  '&mgr->msg_lock'

sound/pci/mixart/mixart_core.c
    63  static int get_msg(struct mixart_mgr *mgr, struct mixart_msg *resp,
    64                     u32 msg_frame_address )
    65  {
    66          u32  headptr;
    67          u32  size;
    68          int  err;
    69  #ifndef __BIG_ENDIAN
    70          unsigned int i;
    71  #endif
    72  
    73          mutex_lock(&mgr->msg_lock);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^
Smatch says that get_msg() is called with this lock already held.

    74          err = 0;
    75  
    76          /* copy message descriptor from miXart to driver */
    77          size                =  readl_be(MIXART_MEM(mgr, msg_frame_address));       /* size of descriptor + response */
    78          resp->message_id    =  readl_be(MIXART_MEM(mgr, msg_frame_address + 4));   /* dwMessageID */


[ snip ]

   419  irqreturn_t snd_mixart_threaded_irq(int irq, void *dev_id)
   420  {
   421          struct mixart_mgr *mgr = dev_id;
   422          int err;
   423          struct mixart_msg resp;
   424          u32 msg;
   425  
   426          mutex_lock(&mgr->lock);
                ^^^^^^^^^^^^^^^^^^^^^^
We are holding the lock

   427          /* process interrupt */
   428          while (retrieve_msg_frame(mgr, &msg)) {
   429  
   430                  switch (msg & MSG_TYPE_MASK) {
   431                  case MSG_TYPE_COMMAND:
   432                          resp.message_id = 0;
   433                          resp.data = mixart_msg_data;
   434                          resp.size = sizeof(mixart_msg_data);
   435                          err = get_msg(mgr, &resp, msg & ~MSG_TYPE_MASK);
                                      ^^^^^^^^^^^
When get_msg() is called on this path.

   436                          if( err < 0 ) {
   437                                  dev_err(&mgr->pci->dev,
   438                                          "interrupt: error(%d) reading mf %x\n",
   439                                          err, msg);
   440                                  break;
   441                          }
   442  
   443                          if(resp.message_id == MSG_SERVICES_TIMER_NOTIFY) {

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-18 13:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18 13:52 [bug report] ALSA: mixart: Use nonatomic PCM ops Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.