Linux bluetooth development
 help / color / mirror / Atom feed
From: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCHv3 02/11] android/core: Remove unneeded assignment
Date: Tue, 29 Jul 2014 10:42:03 +0300	[thread overview]
Message-ID: <20140729074200.GA29412@aemeltch-MOBL1> (raw)
In-Reply-To: <20140728135750.GA17010@t440s.P-661HNU-F1>

Hi Johan,

On Mon, Jul 28, 2014 at 04:57:50PM +0300, Johan Hedberg wrote:
> Hi Andrei,
> 
> On Mon, Jul 28, 2014, Andrei Emeltchenko wrote:
> > ---
> >  android/bluetooth.c | 1 -
> >  1 file changed, 1 deletion(-)
> > 
> > diff --git a/android/bluetooth.c b/android/bluetooth.c
> > index a2ab445..5b72a36 100644
> > --- a/android/bluetooth.c
> > +++ b/android/bluetooth.c
> > @@ -291,7 +291,6 @@ static void load_adapter_config(void)
> >  	if (gerr) {
> >  		adapter.discoverable_timeout = DEFAULT_DISCOVERABLE_TIMEOUT;
> >  		g_error_free(gerr);
> > -		gerr = NULL;
> >  	}
> >  
> >  	g_key_file_free(key_file);
> 
> I don't think patches like this are a good idea since they make the code
> more prone to bugs in the future. In this case if the function was ever
> extended and gerr reused one would need to remember to "fix" the old
> code so that it's re-initialized to NULL.

This is common practice, to initialize if needed value before use
(especially if value is reused). Makes code more clean.

This also fixes static analyzer warnings.

Best regards 
Andrei Emeltchenko 

  reply	other threads:[~2014-07-29  7:42 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17  8:55 [PATCH 1/2] core: Remove unneeded assignment Andrei Emeltchenko
2014-07-17  8:55 ` [PATCH 2/2] android/core: " Andrei Emeltchenko
2014-07-18 13:28 ` [PATCHv2 1/6] core: " Andrei Emeltchenko
2014-07-18 13:28   ` [PATCHv2 2/6] android/core: " Andrei Emeltchenko
2014-07-18 13:28   ` [PATCHv2 3/6] tools/rctest: Remove unneeded return Andrei Emeltchenko
2014-07-18 13:28   ` [PATCHv2 4/6] tools/rctest: Remove dead code Andrei Emeltchenko
2014-07-18 13:28   ` [PATCHv2 5/6] tools/scotest: Remove unneeded return Andrei Emeltchenko
2014-07-18 13:28   ` [PATCHv2 6/6] tools/l2test: " Andrei Emeltchenko
2014-07-28 12:46 ` [PATCHv3 01/11] core: Remove unneeded assignment Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 02/11] android/core: " Andrei Emeltchenko
2014-07-28 13:57     ` Johan Hedberg
2014-07-29  7:42       ` Andrei Emeltchenko [this message]
2014-07-29  7:50         ` Johan Hedberg
2014-07-28 12:46   ` [PATCHv3 03/11] tools/rctest: Remove unneeded return Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 04/11] tools/rctest: Remove dead code Andrei Emeltchenko
2014-07-28 13:58     ` Johan Hedberg
2014-07-28 12:46   ` [PATCHv3 05/11] tools/scotest: Remove unneeded return Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 06/11] tools/l2test: " Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 07/11] tools/scotest: Fix double close socket Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 08/11] android/ipc: Remove unneeded check Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 09/11] tools: Fix memory leak Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 10/11] obexd: " Andrei Emeltchenko
2014-07-28 12:46   ` [PATCHv3 11/11] " Andrei Emeltchenko
2014-07-29 14:20 ` [PATCHv4 01/12] core: Remove unneeded assignment Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 02/12] android/core: Use g_clear_error instead of free and assignment Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 03/12] tools/rctest: Remove unneeded return Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 04/12] tools/rctest: Remove dead code Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 05/12] tools/scotest: Remove unneeded return Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 06/12] tools/l2test: " Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 07/12] tools/scotest: Fix double close socket Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 08/12] android/ipc: Remove unneeded check Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 09/12] tools: Fix memory leak Andrei Emeltchenko
2014-08-01 10:35     ` Johan Hedberg
2014-08-01 11:12       ` Andrei Emeltchenko
2014-08-01 11:21         ` Johan Hedberg
2014-08-01 11:27           ` Andrei Emeltchenko
2014-08-01 11:33             ` Johan Hedberg
2014-08-01 11:54               ` Andrei Emeltchenko
2014-07-29 14:20   ` [PATCHv4 10/12] obexd: " Andrei Emeltchenko
2014-08-01 10:36     ` Johan Hedberg
2014-07-29 14:21   ` [PATCHv4 11/12] " Andrei Emeltchenko
2014-08-01 10:38     ` Johan Hedberg
2014-08-01 11:18       ` [PATCHv4 1/3] tools: " Andrei Emeltchenko
2014-08-01 11:18         ` [PATCHv4 2/3] obexd: " Andrei Emeltchenko
2014-08-01 11:18         ` [PATCHv4 3/3] " Andrei Emeltchenko
2014-08-01 11:26       ` [PATCHv5 1/3] tools: " Andrei Emeltchenko
2014-08-01 11:26         ` [PATCHv5 2/3] obexd: " Andrei Emeltchenko
2014-08-01 11:26         ` [PATCHv5 3/3] " Andrei Emeltchenko
2014-08-04  6:11         ` [PATCHv5 1/3] tools: " Johan Hedberg
2014-07-29 14:21   ` [PATCHv4 12/12] attrib: " Andrei Emeltchenko
2014-08-01 10:40     ` Johan Hedberg
2014-08-01  8:48   ` [PATCHv4 01/12] core: Remove unneeded assignment Andrei Emeltchenko

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=20140729074200.GA29412@aemeltch-MOBL1 \
    --to=andrei.emeltchenko.news@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