[Cocci] Re: net: use NETDEV_TX_OK instead of 0 in ndo_start_xmit() functions

Julia Lawall julia at diku.dk
Tue Jun 23 23:27:52 CEST 2009


Joe,

Thanks for forwarding the message.

Patrick,

Perhaps the problem is that when you use ..., it expects the pattern to 
hold on all control-flow paths.  In your function there are probably some 
control-flow paths that end in returns you want to trandofrm, but also 
some that end in other things.

Instead, you could do:

int xmit(struct sk_buff *skb, struct net_device *dev)
{
<...
(
-     return 1;
+     return NETDEV_TX_BUSY;
|
-     return -1;
+     return NETDEV_TX_LOCKED;
|
-     return 0;
+     return NETDEV_TX_OK;
)
...>
}

The <... ...> means do it wherever and however many times it occurs.

If ther are still some cases that don't work, perhaps you could send me an 
extract of the C code?  It might be that there was a problem in parsing 
the C function, in which case nothing will happen.

julia


More information about the Cocci mailing list