public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Julia Lawall <julia.lawall@inria.fr>, cocci@inria.fr
Subject: Re: [cocci] Searching for missing cleanup function calls (with SmPL)?
Date: Fri, 12 Sep 2025 11:29:03 +0200	[thread overview]
Message-ID: <504107f9-09eb-47fe-96ea-53e375b17eac@web.de> (raw)
In-Reply-To: <1bfe79b9-f7a4-c20-f116-75d9fe1642b2@inria.fr>

> But if there are cases where dn really should be freed, that could be
> something to write a patch for.

I would like to clarify possible software development consequences
also according to a diff output like the following.

Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch …/Projekte/Coccinelle/janitor/show_missing_of_node_put.cocci arch/powerpc/sysdev/fsl_rio.c
…
@@ -511,7 +511,6 @@ static int fsl_rio_setup(struct platform
        }
 
        /*set up doobell node*/
-       np = of_find_compatible_node(NULL, NULL, "fsl,srio-dbell-unit");
        if (!np) {
                dev_err(&dev->dev, "No fsl,srio-dbell-unit node\n");
                rc = -ENODEV;
@@ -537,7 +536,6 @@ static int fsl_rio_setup(struct platform
                                (u32)range_start);
 
        /*set up port write node*/
-       np = of_find_compatible_node(NULL, NULL, "fsl,srio-port-write-unit");
        if (!np) {
                dev_err(&dev->dev, "No fsl,srio-port-write-unit node\n");
                rc = -ENODEV;

real    0m0,968s
user    0m0,547s
sys     0m0,059s


I would expect that the previously mentioned SmPL code “... when != dn”
should exclude some C source code.
How does the shown test result fit to this expectation on the behaviour
of the Coccinelle software (when there are obviously places where the found variable
is used again after a null pointer check)?


But it seems that the code is still improvable.
https://elixir.bootlin.com/linux/v6.17-rc5/source/arch/powerpc/sysdev/fsl_rio.c#L439-L731

I guess that of_node_put() should be called before the affected variable
is reassigned here.
https://elixir.bootlin.com/linux/v6.17-rc5/source/drivers/of/base.c#L1011-L1022

I would appreciate your advice.

Regards,
Markus

  parent reply	other threads:[~2025-09-12  9:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04 12:36 [cocci] Searching for missing cleanup function calls (with SmPL)? Markus Elfring
2025-09-04 12:43 ` Julia Lawall
2025-09-04 12:58   ` Markus Elfring
2025-09-12  9:29   ` Markus Elfring [this message]
2025-09-12 11:07     ` Julia Lawall
2025-09-12 12:30       ` Markus Elfring
2025-09-12 13:43     ` Markus Elfring
2025-09-12 15:43   ` Markus Elfring
2025-09-06  8:00 ` [cocci] Searching for selected variable assignments " Markus Elfring
2025-09-06  8:07   ` Julia Lawall
2025-09-06  8:10     ` Markus Elfring
2025-09-06  8:22       ` Julia Lawall
2025-09-06  9:11         ` Markus Elfring
2025-09-06  9:14           ` Julia Lawall
2025-09-06  9:28             ` Markus Elfring
2025-09-06 10:25               ` Markus Elfring
2025-09-06 11:12                 ` Julia Lawall
2025-09-06 12:07                   ` Markus Elfring
2025-09-06 12:13                     ` Julia Lawall
2025-09-06 12:30                       ` Markus Elfring
2025-09-06 12:36                         ` Julia Lawall
2025-09-06 12:47                           ` Markus Elfring
2025-09-06 12:51                             ` Julia Lawall
2025-09-06 13:20     ` Markus Elfring
2025-09-08  6:15       ` Markus Elfring

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=504107f9-09eb-47fe-96ea-53e375b17eac@web.de \
    --to=markus.elfring@web.de \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@inria.fr \
    /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