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

Patrick McHardy kaber at trash.net
Fri Jun 26 14:59:11 CEST 2009


Julia Lawall wrote:
> 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.

Thanks for the hint, I'll try that and will let you know if it
still doesn't work.



More information about the Cocci mailing list