From: Varka Bhadram <var...@cdac.in>

This patch introduce the common error path on failure of Tx by
inserting the label 'err_tx'.

Signed-off-by: Varka Bhadram <var...@cdac.in>
---
 net/mac802154/tx.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 8124353..fdf4c0e6 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -89,8 +89,7 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, struct 
sk_buff *skb,
 
        if (!(priv->phy->channels_supported[page] & (1 << chan))) {
                WARN_ON(1);
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
+               goto err_tx;
        }
 
        mac802154_monitors_rx(mac802154_to_priv(&priv->hw), skb);
@@ -103,12 +102,10 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, 
struct sk_buff *skb,
                data[1] = crc >> 8;
        }
 
-       if (skb_cow_head(skb, priv->hw.extra_tx_headroom)) {
-               kfree_skb(skb);
-               return NETDEV_TX_OK;
-       }
+       if (skb_cow_head(skb, priv->hw.extra_tx_headroom))
+               goto err_tx;
 
-       work = kzalloc(sizeof(struct xmit_work), GFP_ATOMIC);
+       work = kzalloc(sizeof(*work), GFP_ATOMIC);
        if (!work) {
                kfree_skb(skb);
                return NETDEV_TX_BUSY;
@@ -129,4 +126,8 @@ netdev_tx_t mac802154_tx(struct mac802154_priv *priv, 
struct sk_buff *skb,
        queue_work(priv->dev_workqueue, &work->work);
 
        return NETDEV_TX_OK;
+
+err_tx:
+       kfree_skb(skb);
+       return NETDEV_TX_OK;
 }
-- 
1.7.9.5


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to