From: Tedd Ho-Jeong An <tedd.an@intel.com>
To: linux-bluetooth <linux-bluetooth@vger.kernel.org>
Cc: "tedd.an" <tedd.an@intel.com>
Subject: hicattach: fix return length after reading the patch file
Date: Mon, 02 Jul 2012 09:52:17 -0700 [thread overview]
Message-ID: <1898220.KzhPWWYfm0@tedd-ubuntu> (raw)
From: Tedd Ho-Jeong AN <tedd.an@intel.com>
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(-)
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
@@ -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;
}
/**
--
1.7.9.5
next reply other threads:[~2012-07-02 16:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-02 16:52 Tedd Ho-Jeong An [this message]
2012-07-04 12:42 ` hicattach: fix return length after reading the patch file Johan Hedberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1898220.KzhPWWYfm0@tedd-ubuntu \
--to=tedd.an@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox