On Fri, Nov 22, 2013 at 4:57 PM, Dan Carpenter <dan.carpen...@oracle.com> wrote:
> This is a lot of spaghetti.  Just write it like this:
>
>
>         if (adapter->tx_ring.used >= NUM_TCB)
>                 goto drop;
>         if (adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK)
>                 goto drop;
>         if (!netif_carrier_ok(netdev))
>                 goto drop;
>         status = send_packet(skb, adapter);
>         if (status)
>                 goto drop;
>
>         return NETDEV_TX_OK;
>
> drop:
>         dev_kfree_skb_any(skb);
>         adapter->net_stats.tx_dropped++;
>
>         /* We return success deliberately to make the netif layer happy */
>         return NETDEV_TX_OK;
>
> In the original code the success path was if condition false, then if
> condition true, then follow a goto then return.  In the new code it is
> straight line path to success with no nested if else statements.
>

This made the code more clear, I will apply it in resent patch. Thanks
for your review.
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to