Linux bluetooth development
 help / color / mirror / Atom feed
From: Gowtham Anandha Babu <gowtham.ab@samsung.com>
To: 'Johan Hedberg' <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, bharat.panda@samsung.com,
	cpgs@samsung.com
Subject: RE: [PATCH 1/2] tools/btsnoop : Fix variable reassigning issue
Date: Mon, 15 Sep 2014 11:45:07 +0530	[thread overview]
Message-ID: <000c01cfd0ac$68ce5a20$3a6b0e60$@samsung.com> (raw)
In-Reply-To: <20140912165155.GB3671@t440s>

Hi,

> -----Original Message-----
> From: Johan Hedberg [mailto:johan.hedberg@gmail.com]
> Sent: Friday, September 12, 2014 10:22 PM
> To: gowtham babu
> Cc: linux-bluetooth@vger.kernel.org; bharat.panda@samsung.com;
> cpgs@samsung.com
> Subject: Re: [PATCH 1/2] tools/btsnoop : Fix variable reassigning issue
> 
> Hi,
> 
> On Wed, Sep 10, 2014, gowtham babu wrote:
> > The Variable 'written' is reassigned a value before the old one has been
> used.
> > The below on fix the same.
> > ---
> >  tools/btsnoop.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/btsnoop.c b/tools/btsnoop.c index 6ca62d2..86f4691
> > 100644
> > --- a/tools/btsnoop.c
> > +++ b/tools/btsnoop.c
> > @@ -211,7 +211,7 @@ next_packet:
> >  		goto next_packet;
> >  	}
> >
> > -	written = input_pkt[select_input].size = htobe32(toread - 1);
> > +	input_pkt[select_input].size = htobe32(toread - 1);
> >  	written = input_pkt[select_input].len = htobe32(toread - 1);
> 
> Why is there a need to evaluate htobe32(toread - 1) twice here? Why not
> avoid that by something like:
> 
> 	written = htobe32(toread - 1);
> 	input_pkt[select_input].size = written;
> 	input_pkt[select_input].len  = written;
> 
> Johan


I had fixed this and sent the revised patch. Please have a look at it.

Regards,
Gowtham


      reply	other threads:[~2014-09-15  6:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10  6:35 [PATCH 1/2] tools/btsnoop : Fix variable reassigning issue gowtham babu
2014-09-12 16:51 ` Johan Hedberg
2014-09-15  6:15   ` Gowtham Anandha Babu [this message]

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='000c01cfd0ac$68ce5a20$3a6b0e60$@samsung.com' \
    --to=gowtham.ab@samsung.com \
    --cc=bharat.panda@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=johan.hedberg@gmail.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