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

From: Rupesh Gujare
Date: Wed Nov 21 2012 - 08:03:23 EST


Free memory if timer pool count > OZ_MAX_TIMER_POOL_SIZE

Signed-off-by: Sachin Kamat <sachin.kamat@xxxxxxxxxx>
Signed-off-by: Rupesh Gujare <rgujare@xxxxxxxxxxxxxxx>
---
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/