linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* hicattach: fix return length after reading the patch file
@ 2012-07-02 16:52 Tedd Ho-Jeong An
  2012-07-04 12:42 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Tedd Ho-Jeong An @ 2012-07-02 16:52 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: tedd.an

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: hicattach: fix return length after reading the patch file
  2012-07-02 16:52 hicattach: fix return length after reading the patch file Tedd Ho-Jeong An
@ 2012-07-04 12:42 ` Johan Hedberg
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-07-04 12:42 UTC (permalink / raw)
  To: Tedd Ho-Jeong An; +Cc: linux-bluetooth

Hi Tedd,

On Mon, Jul 02, 2012, Tedd Ho-Jeong An wrote:
> 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(-)

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-04 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-02 16:52 hicattach: fix return length after reading the patch file Tedd Ho-Jeong An
2012-07-04 12:42 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).