Checking adjustments for pointer resets with SmPL
Hello,
I have noticed the update suggestion “USB: quirks: simplify quirk handling”.
https://lore.kernel.org/linux-usb/[email protected]/
https://lore.kernel.org/patchwork/patch/1308991/
Thus I converted a patch hunk into the following script variant for
the semantic patch language (according to the software “Coccinelle 1.0.8-00177-g28737419”).
@adjustment@
identifier allocate, object, release;
@@
-if (object)
-{
-release(object);
-object = NULL;
-}
+release(object);
object = allocate(..., sizeof(...), ...);
Now I wonder at the moment why a known patch is not generated. (An error message is not displayed.)
elfring@Sonne:~/Projekte/Linux/next-patched> spatch drivers/usb/core/quirks.c ~/Projekte/Coccinelle/janitor/simplify_pointer_reset2.cocci
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci
Quoted 3 lines
I have noticed the update suggestion “USB: quirks: simplify quirk handling”.
https://lore.kernel.org/linux-usb/[email protected]/
https://lore.kernel.org/patchwork/patch/1308991/
I would like to point out that an acceptable patch can be generated for the implementation of the function “quirks_param_set” according to a known transformation pattern by the following SmPL script variant.
@adjustment@
identifier allocate, object, release;
type t;
@@
-if (object)
-{
-release(object);
-object = NULL;
-}
+release(object);
object = allocate(..., sizeof(t), ...);
Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci