Skip to contentSkip to conversation

hicattach: fix return length after reading the patch file

PATCH Applied Tedd Ho-Jeong An 2 participants 2 messages Jul 2, 2012 – Jul 4, 2012 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

From: Tedd Ho-Jeong AN <[email protected]>

This patch fixes the issue that returns alwasy 0 after reading the patch line.

---
 tools/hciattach_intel.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
tools/hciattach_intel.c +3 -4
index 9129993..749098e 100644
@@ -148,14 +148,13 @@ static int validate_events(struct patch_entry *event,
  */
 static int get_next_patch_entry(int fd, struct patch_entry *entry)
 {
-	int len, size;
+	int size;
 	char rb;
 
 	if (read(fd, &rb, 1) <= 0)
 		return 0;
 
 	entry->type = rb;
-	len = 0;
 
 	switch (entry->type) {
 	case PATCH_TYPE_CMD:
@@ -176,7 +175,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry)
 	case PATCH_TYPE_EVT:
 		entry->data[0] = HCI_EVENT_PKT;
 
-		if (read(fd, &entry->data[len], 2) < 0)
+		if (read(fd, &entry->data[1], 2) < 0)
 			return -1;
 
 		size = (int)entry->data[2];
@@ -193,7 +192,7 @@ static int get_next_patch_entry(int fd, struct patch_entry *entry)
 		return -1;
 	}
 
-	return len;
+	return entry->len;
 }
 
 /**
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Tedd,

Quoted 7 lines · Tedd Ho-Jeong An

From: Tedd Ho-Jeong AN <[email protected]>

This patch fixes the issue that returns alwasy 0 after reading the patch line.

---
 tools/hciattach_intel.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Applied. Thanks.

For the future, please pay attention to the correctness of your commit messages. I had to fix two typos in this one.

Johan