From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751678AbcFAWmn (ORCPT ); Wed, 1 Jun 2016 18:42:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43838 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750926AbcFAWmm (ORCPT ); Wed, 1 Jun 2016 18:42:42 -0400 Date: Wed, 1 Jun 2016 15:42:40 -0700 From: Andrew Morton To: Luis de Bethencourt Cc: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, fabf@skynet.be Subject: Re: [PATCH] befs/btree: remove unneeded initializations Message-Id: <20160601154240.3bb9760d518af5bc95548016@linux-foundation.org> In-Reply-To: <1464568799-12631-1-git-send-email-luisbg@osg.samsung.com> References: <1464568799-12631-1-git-send-email-luisbg@osg.samsung.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 May 2016 01:39:59 +0100 Luis de Bethencourt wrote: > off in befs_bt_read_node() will be written by befs_read_datastream(), with > the value that node->od_node needs. > > node_off in befs_btree_read() isn't read before set to root_node_ptr. > > Removing these two unneeded initializations. > > ... > > --- a/fs/befs/btree.c > +++ b/fs/befs/btree.c > @@ -196,7 +196,7 @@ static int > befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds, > struct befs_btree_node *node, befs_off_t node_off) > { > - uint off = 0; > + uint off; > > befs_debug(sb, "---> %s", __func__); > With this code: int foo; bar(&foo); whatever = foo; some versions of gcc will warn that foo might be used uninitialized. Other versions of gcc don't do this. That's why the seemingly-unneeded initializations are there. Neither of the versions of gcc which I tested with actually do warn, but I'm inclined to leave things as-is: some people will get warnings and that's probably worse than a couple of bytes bloat in befs. It shouldn't cause any bloat, really. We have the "uninitialized_var" macro which avoids any bloat and is self-documenting. And the nice thing about self-documenting code is that it prevents Andrew from having to explain strange code to Luis ;) But unintialized_var in unpopular for reasons which I personally find unpersuasive, given the advantages...