Hello,

I have tried another small SmPL script out.


@display@
identifier work;
statement s1, s2;
type T;
@@
 T work(...)
 {
 ... when any
*{
    ... when any
*   s1
*   s2
*}
 ... when any
 }


I have observed then that the following diff hunk was generated.


elfring@Sonne:~/Projekte/Linux/next-patched> spatch 
~/Projekte/Coccinelle/janitor/show_last_two_statements_in_a_block.cocci 
drivers/net/ethernet/ti/netcp_ethss.c|less
…
@@ -3015,11 +2859,6 @@ static int init_slave(struct gbe_priv *g
        }

        if (of_property_read_u32(node, "link-interface",
-                                &slave->link_interface)) {
-               dev_warn(gbe_dev->dev,
-                        "missing link-interface value defaulting to 1G mac-phy 
link\n");
-               slave->link_interface = SGMII_LINK_MAC_PHY;
-       }

        slave->node = node;
        slave->open = false;
…


Now I wonder about the suggested change for the if statement here.
Should any more software adjustments be considered so that it will be avoided
to delete only a questionable part from a function call within a condition 
check?

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to