All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] Searching for questionable call pairs (with SmPL)?
@ 2025-07-23  7:45 Markus Elfring
  2025-07-24 14:15 ` Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 49+ messages in thread
From: Markus Elfring @ 2025-07-23  7:45 UTC (permalink / raw)
  To: cocci; +Cc: Erick Karanja

Hello,

I noticed another contribution.

I got into the mood to construct another script for the semantic patch language.


// See also:
// [PATCH v4] ALSA: usb-audio: qcom: Adjust mutex unlock order
// https://lore.kernel.org/linux-sound/20250721114554.1666104-1-karanja99erick@gmail.com/
@display@
expression x, y;
@@
*mutex_lock(x);
 ...
*mutex_lock(y);
 <+...
*mutex_unlock(x);
 ...
*mutex_unlock(y);
 ...+>


Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> git checkout next-20250722 && time /usr/bin/spatch --no-loops …/Projekte/Coccinelle/janitor/show_questionable_unlock_call_order.cocci sound/usb/qcom/qc_audio_offload.c
…
@@ -1580,7 +1576,6 @@ static void handle_uaudio_stream_req(str
                goto response;
        }
 
-       mutex_lock(&chip->mutex);
        if (req_msg->enable) {
                if (info_idx < 0 || chip->system_suspend || subs->opened) {
                        ret = -EBUSY;
@@ -1613,9 +1608,7 @@ static void handle_uaudio_stream_req(str
                        ret = prepare_qmi_response(subs, req_msg, &resp,
                                                   info_idx);
                if (ret < 0) {
-                       mutex_lock(&chip->mutex);
                        subs->opened = 0;
-                       mutex_unlock(&chip->mutex);
                }
        } else {
                info = &uadev[pcm_card_num].info[info_idx];
@@ -1646,9 +1639,7 @@ static void handle_uaudio_stream_req(str
                }
 
                disable_audio_stream(subs);
-               mutex_lock(&chip->mutex);
                subs->opened = 0;
-               mutex_unlock(&chip->mutex);
        }
 
 response:
@@ -1662,7 +1653,6 @@ response:
                if (atomic_read(&uadev[pcm_card_num].in_use))
                        kref_put(&uadev[pcm_card_num].kref,
                                 uaudio_dev_release);
-               mutex_unlock(&chip->mutex);
        }
        mutex_unlock(&qdev_mutex);
 
…
real    0m0,501s
user    0m0,460s
sys     0m0,035s


Now I wonder how these diff hunks fit to my source code search approach
for finding call pairs of known functions (or macros).
Will another clarification become more interesting?

Regards,
Markus

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2025-08-06  9:30 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-23  7:45 [cocci] Searching for questionable call pairs (with SmPL)? Markus Elfring
2025-07-24 14:15 ` Markus Elfring
2025-07-24 14:47 ` Julia Lawall
2025-07-24 15:02   ` Markus Elfring
2025-07-24 15:09     ` Julia Lawall
2025-07-24 15:15       ` Markus Elfring
2025-07-24 15:25         ` Julia Lawall
2025-07-24 15:30           ` Markus Elfring
2025-07-24 16:18       ` Markus Elfring
2025-07-30 12:10       ` Markus Elfring
2025-08-01  7:33         ` Markus Elfring
2025-08-01  8:06           ` Julia Lawall
2025-08-01  8:33             ` Markus Elfring
2025-08-02 10:13             ` [cocci] Searching for lock calls without unlocking " Markus Elfring
2025-08-02 11:18               ` Markus Elfring
2025-08-02 11:28                 ` Julia Lawall
2025-08-02 11:51                   ` Markus Elfring
2025-08-02 11:54                     ` Julia Lawall
2025-08-02 12:02                       ` Markus Elfring
2025-08-02 12:10                         ` Julia Lawall
2025-08-02 12:56                           ` Markus Elfring
2025-08-02 13:05                             ` Julia Lawall
2025-08-02 13:33                               ` Markus Elfring
2025-08-02 13:45                                 ` Julia Lawall
2025-08-02 14:06                                   ` Markus Elfring
2025-08-02 15:43                               ` Markus Elfring
2025-08-02 15:46                                 ` Julia Lawall
2025-08-02 16:01                                   ` Markus Elfring
2025-08-02 16:04                                     ` Julia Lawall
2025-08-02 16:18                                       ` Markus Elfring
2025-08-02 16:24                                         ` Julia Lawall
2025-08-02 16:35                                           ` Markus Elfring
2025-08-02 17:38                                             ` Julia Lawall
2025-08-02 18:11                                               ` Markus Elfring
2025-08-02 19:12                                                 ` Julia Lawall
2025-08-02 19:26                                                   ` Markus Elfring
2025-08-02 19:35                                                     ` Julia Lawall
2025-08-02 19:42                                                       ` Markus Elfring
2025-08-02 19:44                                                         ` Julia Lawall
2025-08-02 19:48                                                           ` [cocci] Evolution of software documentation? Markus Elfring
2025-08-03  5:24                                                   ` [cocci] Searching for lock calls without unlocking (with SmPL)? Markus Elfring
2025-08-03  5:34                                                     ` Julia Lawall
2025-08-03  5:55                                                       ` Markus Elfring
2025-08-03  7:55                                                       ` Markus Elfring
2025-08-04 10:55             ` [cocci] Searching for questionable call pairs " Markus Elfring
2025-08-04 11:25               ` [cocci] Searching for lock calls without unlocking " Markus Elfring
2025-08-06  9:30               ` [cocci] Searching for repeated actions " Markus Elfring
2025-07-24 18:37 ` [cocci] Searching for questionable call pairs " Markus Elfring
2025-07-25  7:06 ` Markus Elfring

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.