[bug report] ALSA: mixart: Use nonatomic PCM ops
Dan Carpenter
dan.carpenter at oracle.com
Wed Nov 18 14:52:12 CET 2020
[ 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
More information about the Alsa-devel
mailing list