From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752791AbdJSLhW (ORCPT ); Thu, 19 Oct 2017 07:37:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:51423 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbdJSLhV (ORCPT ); Thu, 19 Oct 2017 07:37:21 -0400 Date: Thu, 19 Oct 2017 13:37:18 +0200 From: Michal =?UTF-8?B?U3VjaMOhbmVr?= To: SF Markus Elfring Cc: linuxppc-dev@lists.ozlabs.org, Alex Williamson , Alexey Kardashevskiy , Andrew Morton , Bart Van Assche , Benjamin Herrenschmidt , David Gibson , Doug Ledford , Greg Kroah-Hartman , Johan Hovold , Masahiro Yamada , Michael Ellerman , Nathan Fontenot , Paul Mackerras , Rob Herring , Sahil Mehta , Tyrel Datwyler , kernel-janitors@vger.kernel.org, LKML Subject: Re: [PATCH 3/5] powerpc-pseries: Delete an unnecessary variable initialisation in iommu_pseries_alloc_group() Message-ID: <20171019133718.5bdab33c@kitsune.suse.cz> In-Reply-To: <9c71e3e0-8998-fd02-e3a3-ef219d82ee32@users.sourceforge.net> References: <0d221be4-1402-0499-d95e-afa4a30e1f33@users.sourceforge.net> <9c71e3e0-8998-fd02-e3a3-ef219d82ee32@users.sourceforge.net> X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-suse-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 Hello, On Wed, 18 Oct 2017 21:24:25 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Wed, 18 Oct 2017 19:14:39 +0200 > > The variable "table_group" will be set to an appropriate pointer. > Thus omit the explicit initialisation at the beginning. > > Signed-off-by: Markus Elfring > --- > arch/powerpc/platforms/pseries/iommu.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/platforms/pseries/iommu.c > b/arch/powerpc/platforms/pseries/iommu.c index > b37d4fb20d1c..b6c12b8e3ace 100644 --- > a/arch/powerpc/platforms/pseries/iommu.c +++ > b/arch/powerpc/platforms/pseries/iommu.c @@ -55,7 +55,7 @@ > > static struct iommu_table_group *iommu_pseries_alloc_group(int node) > { > - struct iommu_table_group *table_group = NULL; > + struct iommu_table_group *table_group; > struct iommu_table *tbl = NULL; > struct iommu_table_group_link *tgl = NULL; > I think initializing pointers to NULL is generally a good idea. If there is no use of the variable before it is reinitialized by allocation gcc is free to optimize out the variable and its initial value. On the other hand, if the code is changed later and use of the variable becomes possible you may crash (and get a gcc warning, too). Removing these initializers adds no value, to the contrary. Thanks Michal