[PATCH 09/10] fix count error on multiple packets in one buffer

From: Mark P . Mendelsohn
Date: Mon Oct 03 2011 - 15:40:04 EST


---
drivers/bluetooth/hci_h5.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 957dc3e..d629d2b 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -637,7 +637,8 @@ static int h5_recv(struct hci_uart *hu, void *data, int count)

while (count) {
#ifdef DEBUG
- printk("while count %d rx_count %d\n", count, h5->rx_count);
+ printk("while count %d rx_count %d ptr %02x state %d\n", count,
+ h5->rx_count, *ptr, h5->rx_state);
#endif

if (h5->rx_count) {
@@ -722,7 +723,6 @@ static int h5_recv(struct hci_uart *hu, void *data, int count)

h5_complete_rx_pkt(hu);
h5->rx_state = H5_W4_PKT_DELIMITER;
- count--;
continue;

case H5_W4_PKT_DELIMITER:
@@ -777,6 +777,9 @@ static int h5_recv(struct hci_uart *hu, void *data, int count)
}
}

+ printk("leaving h5_recv rx_state %d rx_count %d ptr %02x\n", h5->rx_state,
+ h5->rx_count, *ptr);
+
if (h5->txack_req) {
/* If needed, transmit an ack pkt */
hci_uart_tx_wakeup(hu);
--
1.7.1