diff --git a/tools/hciattach_intel.c b/tools/hciattach_intel.c
index 9129993..749098e 100644
--- a/tools/hciattach_intel.c
+++ b/tools/hciattach_intel.c
*/
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:
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];
return -1;
}
- return len;
+ return entry->len;
}
/**