From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [net-next PATCH 2/2] mlxsw: spectrum_kvdl: avoid uninitialized variable warning Date: Mon, 26 Feb 2018 11:33:29 -0500 (EST) Message-ID: <20180226.113329.1873010713546052461.davem@davemloft.net> References: <20180223131540.1065413-1-arnd@arndb.de> <20180223131540.1065413-2-arnd@arndb.de> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: arkadis@mellanox.com, jiri@mellanox.com, idosch@mellanox.com, weiyongjun1@huawei.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org To: arnd@arndb.de Return-path: In-Reply-To: <20180223131540.1065413-2-arnd@arndb.de> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org From: Arnd Bergmann Date: Fri, 23 Feb 2018 14:15:32 +0100 > gcc warns that 'resource_id' is not initialized if we don't come though > any of the three 'case' statements before: > > drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c: In function 'mlxsw_sp_kvdl_part_init': > drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c:275:8: error: 'resource_id' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > In the current code, that won't happen, but it's more robust to explicitly > handle this by returning a failure from mlxsw_sp_kvdl_part_init. > > Fixes: 887839e6960d ("mlxsw: spectrum_kvdl: Add support for dynamic partition set") > Signed-off-by: Arnd Bergmann Applied.