Re: [PATCHv3 02/11] android/core: Remove unneeded assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux