[lvc-project] [cocci] [PATCH] cocci: drm: report devm-allocated arguments and fields
Markus Elfring
Markus.Elfring at web.de
Sat Sep 27 12:33:47 MSK 2025
…> +// find devm-allocated (devres-managed) second arg for drm*init functions
> + at badarg exists@
> +position p;
> +expression devm,e;
> +@@
> +// only devm_kzalloc is really used
> +devm = \(devm_kzalloc\|devm_kcalloc\|devm_kmalloc\|devm_kmalloc_array\)(...);
> +...
…> +// same as above, but with an intermediate local variable
> + at badarg2 exists@
> +position p;
> +expression devm,e;
> +identifier vitm;
> +@@
> +// only devm_kzalloc is really used
> +devm = \(devm_kzalloc\|devm_kcalloc\|devm_kmalloc\|devm_kmalloc_array\)(...);
> +...
> +vitm = <+...devm...+>;
…
Your source code search approach affects recurring development concerns.
The shown rules start with the same SmPL code.
Thus I would find it nicer if such duplicate code can be avoided.
I imagine that software run time characteristics would be more desirable
if selected data processing does not need to be repeated.
The search should obviously be continued after a relevant source code place was found.
…> + at script:python depends on report@
> +p << badarg.p;
…> + at script:python depends on report@
> +p << badarg2.p;
…> + at script:python depends on report@
> +p << badfield.p;
…
Will development interests grow for another clarification approach?
Support for SmPL rule groups
2019-04-07
https://github.com/coccinelle/coccinelle/issues/164
Regards,
Markus
More information about the lvc-project
mailing list