From: Ulrich Kunitz Date: Wed, 22 Nov 2006 00:06:19 +0000 (+0000) Subject: [PATCH] zd1211rw: Optimized handling of zero length entries in length info X-Git-Tag: v2.6.20-rc2~6^2~13^2~468^2~39 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=850c211ce6948bcd71e505be22b7ead99a425bfa;p=linux-2.6-omap-h63xx.git [PATCH] zd1211rw: Optimized handling of zero length entries in length info There are a high number of split USB transactions, which contain only one packet but have a length info field. This patch optimizes this code by stopping parsing the length info structure if a zero length field is encountered. Signed-off-by: Ulrich Kunitz Signed-off-by: Daniel Drake Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index c3449cfae7e..aa782e88754 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c @@ -593,6 +593,8 @@ static void handle_rx_packet(struct zd_usb *usb, const u8 *buffer, unsigned int l, k, n; for (i = 0, l = 0;; i++) { k = le16_to_cpu(get_unaligned(&length_info->length[i])); + if (k == 0) + return; n = l+k; if (n > length) return;