[PATCH v2] Staging: gdm724x: gdm_usb: added error checking in do_tx()

Abel Moyo abelmoyo.ab at gmail.com
Thu Sep 18 19:49:10 UTC 2014


Added error checking for alloc_tx_struct in do_tx()

Signed-off-by: Abel Moyo <abelmoyo.ab at gmail.com>
---
Changes in v2:
   - Added spin_unlock
   - Removed print error message

 drivers/staging/gdm724x/gdm_usb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/staging/gdm724x/gdm_usb.c b/drivers/staging/gdm724x/gdm_usb.c
index 483185b..5d44490 100644
--- a/drivers/staging/gdm724x/gdm_usb.c
+++ b/drivers/staging/gdm724x/gdm_usb.c
@@ -682,6 +682,10 @@ static void do_tx(struct work_struct *work)
 		}
 
 		t = alloc_tx_struct(TX_BUF_SIZE);
+		if (t == NULL) {
+			spin_unlock_irqrestore(&tx->lock, flags);
+			return;
+		}
 		t->callback = NULL;
 		t->tx = tx;
 		t->is_sdu = 1;
-- 
1.8.5.5



More information about the devel mailing list