Linux bluetooth development
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: gowtham babu <gowtham.ab@samsung.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: Fri, 12 Sep 2014 09:51:55 -0700	[thread overview]
Message-ID: <20140912165155.GB3671@t440s> (raw)
In-Reply-To: <1410330944-3492-1-git-send-email-gowtham.ab@samsung.com>

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

  reply	other threads:[~2014-09-12 16:51 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 [this message]
2014-09-15  6:15   ` Gowtham Anandha Babu

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=20140912165155.GB3671@t440s \
    --to=johan.hedberg@gmail.com \
    --cc=bharat.panda@samsung.com \
    --cc=cpgs@samsung.com \
    --cc=gowtham.ab@samsung.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