* [cocci] Checking addition of local error code checks
@ 2024-01-02 18:00 Markus Elfring
2024-01-03 9:06 ` [cocci] [RFC] fbdev: Completing error handling for fb_alloc_cmap() calls Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2024-01-02 18:00 UTC (permalink / raw)
To: cocci
Hello,
I applied the following SmPL script also together with the software
combination “Coccinelle 1.1.1-00628-gd7ca09d1” on a known source file.
@addition@
@@
+{
+int rc =
fb_alloc_cmap(...);
+if (rc)
+ return rc;
+}
See also:
https://elixir.bootlin.com/linux/v6.7-rc8/source/drivers/video/fbdev/atafb.c#L2988
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/video/fbdev/atafb.c?id=425562be861b46ba8dac78e3927c1cbff5fbb514#n2988
Test result:
Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> spatch …/Projekte/Coccinelle/janitor/return_error_code_for_fb_alloc_cmap_call_failure.cocci drivers/video/fbdev/atafb.c
…
@@ -3126,7 +3126,11 @@ static int __init atafb_probe(struct pla
atafb_set_disp(&fb_info);
- fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0);
+ {
+ int rc =fb_alloc_cmap(&(fb_info.cmap), 1 << fb_info.var.bits_per_pixel, 0);
+ if (rc)
+ return rc;
+ }
…
Such diff output indicates opportunities for pretty-printing improvements.
* Additional space character for variable initialisation
* Line length limit
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [cocci] [RFC] fbdev: Completing error handling for fb_alloc_cmap() calls
2024-01-02 18:00 [cocci] Checking addition of local error code checks Markus Elfring
@ 2024-01-03 9:06 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2024-01-03 9:06 UTC (permalink / raw)
To: linux-fbdev, kernel-janitors, Helge Deller; +Cc: cocci, LKML
> @addition@
> @@
> +{
> +int rc =
> fb_alloc_cmap(...);
> +if (rc)
> + return rc;
> +}
How do you think about to apply this script for the semantic patch language
so that remaining update candidates will be found?
See also:
Clarification approach “Checking addition of local error code checks”
https://lore.kernel.org/cocci/913bb6fa-c168-46f7-ba39-5fdaae586b6e@web.de/
https://sympa.inria.fr/sympa/arc/cocci/2024-01/msg00000.html
Do you find further change possibilities still relevant for 23 source files?
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-01-03 9:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02 18:00 [cocci] Checking addition of local error code checks Markus Elfring
2024-01-03 9:06 ` [cocci] [RFC] fbdev: Completing error handling for fb_alloc_cmap() calls Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).