staging: ozwpan: Fix error checking while transmitting frame.
authorRupesh Gujare <rupesh.gujare@atmel.com>
Fri, 23 Aug 2013 17:33:32 +0000 (18:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 26 Aug 2013 13:27:43 +0000 (06:27 -0700)
Make sure that we return negative value if oz_build_frame()
returns NULL.

Signed-off-by: Rupesh Gujare <rupesh.gujare@atmel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/ozwpan/ozpd.c

index daaff2af14ae0e72292aca61b517d18ffea28301..e1757aa27253f7a3919ea0408fb6c5cb00fe1008 100644 (file)
@@ -618,14 +618,14 @@ static int oz_send_next_queued_frame(struct oz_pd *pd, int more_data)
        pd->last_sent_frame = e;
        skb = oz_build_frame(pd, f);
        spin_unlock(&pd->tx_frame_lock);
+       if (!skb)
+               return -1;
        if (more_data)
                oz_set_more_bit(skb);
        oz_dbg(TX_FRAMES, "TX frame PN=0x%x\n", f->hdr.pkt_num);
-       if (skb) {
-               if (dev_queue_xmit(skb) < 0)
-                       return -1;
+       if (dev_queue_xmit(skb) < 0)
+               return -1;
 
-       }
        return 0;
 }