[V2 PATCH 2/3] staging: ozwpan: Remove redundant null check before kfree in ozproto.c

Rupesh Gujare rgujare at ozmodevices.com
Wed Nov 21 12:46:16 UTC 2012


Free memory if timer pool count > OZ_MAX_TIMER_POOL_SIZE

Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
Signed-off-by: Rupesh Gujare <rgujare at ozmodevices.com>
---
 drivers/staging/ozwpan/ozproto.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c
index cfb5160..832fde1 100644
--- a/drivers/staging/ozwpan/ozproto.c
+++ b/drivers/staging/ozwpan/ozproto.c
@@ -552,8 +552,8 @@ static void oz_protocol_timer(unsigned long arg)
 			t->link.next = g_timer_pool;
 			g_timer_pool = &t->link;
 			g_timer_pool_count++;
-			t = 0;
-		}
+		} else
+			kfree(t);
 		if (!list_empty(&g_timer_list)) {
 			t2 =  container_of(g_timer_list.next,
 				struct oz_timer, link);
@@ -566,8 +566,6 @@ static void oz_protocol_timer(unsigned long arg)
 		}
 		spin_unlock_bh(&g_polling_lock);
 		oz_pd_put(pd);
-		if (t)
-			kfree(t);
 		t = t2;
 	} while (t);
 	g_timer_state = OZ_TIMER_IDLE;
-- 
1.7.5.4





More information about the devel mailing list