Received: by 10.223.185.116 with SMTP id b49csp684507wrg; Fri, 23 Feb 2018 05:16:54 -0800 (PST) X-Google-Smtp-Source: AH8x227bzUUOZbN8mgTdgm42plXkd21MhzXmGROrk7rO+VFhECsFdgtByPXRyMesgsi2z0JF2+4X X-Received: by 2002:a17:902:34e:: with SMTP id 72-v6mr1709278pld.277.1519391814811; Fri, 23 Feb 2018 05:16:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519391814; cv=none; d=google.com; s=arc-20160816; b=Pp2IexHq+/17wnrgWT54L3zBNUeYFoFSf5hZvtLKx56w7zW81vmgtAqf7qPaYhUS2b Mz9nqy6AvIoRxkT1nHI8uX1HDR3CVR6iPEqoER4FySaH4Y8EJOD+YkzKcnXfOWCZHY3J dr3IcQdypWyfMAF95cxv2HymwbL1Cu4AZfOtljKjB/g9kTxKHMze+OuAQsUbiz7CaVqz nhDqD6V1YmiyI94v6B7JAL8jEw/KXoYo9YTX7q6UmYDwQ0eS4KFsXAQ9WRFm3l3vV10J WlUgVhUvT+Hsx/4qeKzPUm+yIpj/IZSluW7kkviI+8GDHsgeXTL16QMVGiVX4exLfg1J LYBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=vl6llu6EW9mWUC/3NU3ff0Wf5kWvURRuXmaK0eQqW7M=; b=JTqaUy3smic1YEnr6eDNzF3CYt1chIIwYfGHv5xJpkHmHDlwWQfkKs2qQ+rea8THbF gS5mJrvPlevkAtqE1hCriMZmdpeJr+eZUWxk/A2y5QIzBa0bc6wH4zXPezDAsJKOv8fK T9HGJTz2XVI5g8nj974laPy2h0t88cvFfPnN6AUBrW2S0DXgsatcrxqC3TPHJDtikjdo RduzCex0R+jAavox7uTSmT2FIn4vua3FKNXAOx6m+go2rzvdkQ3ck7QC4nl7SmwBtJ7K 2abyGVK5lq3yz5l/P9JGN6UIOUvgI9+D8e8SHImAvyDkk4Ljl/0M9fT36OGs3FnZmnE4 cN2A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9-v6si1136636pll.326.2018.02.23.05.16.40; Fri, 23 Feb 2018 05:16:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751712AbeBWNQD (ORCPT + 99 others); Fri, 23 Feb 2018 08:16:03 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:52811 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751408AbeBWNQA (ORCPT ); Fri, 23 Feb 2018 08:16:00 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MGE0B-1evYKv3Lb5-00F8rj; Fri, 23 Feb 2018 14:15:50 +0100 From: Arnd Bergmann To: Arkadi Sharshevsky , Jiri Pirko , Ido Schimmel Cc: Arnd Bergmann , "David S. Miller" , Wei Yongjun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [net-next PATCH 2/2] mlxsw: spectrum_kvdl: avoid uninitialized variable warning Date: Fri, 23 Feb 2018 14:15:32 +0100 Message-Id: <20180223131540.1065413-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20180223131540.1065413-1-arnd@arndb.de> References: <20180223131540.1065413-1-arnd@arndb.de> X-Provags-ID: V03:K0:5tE+at3L2r/OxIBtc2gUVbMk3eZuqPOmENWlSIq+RaWHUaPWjDL 7XrH3l5XdM6hWRy0uwDiv49YO3NCvD7qXit+wjf/0hYudbzfcKyEjvua94rvFIRbblfPc/8 kL12JXWxew7RX7qTwFJ0mPh5CxdZ6ffkPW6CeX8jwyJEh+tEe+rngLzThzAAPzf0z7zouUP 76AztMtD/H0axLF2sg1KA== X-UI-Out-Filterresults: notjunk:1;V01:K0:LOGF/6oN0UE=:bbpFSrnGP08TqsrgSkibes li66B1ijPwexIl6KKjTJ0xeHe7JeGW5fOncNUdHCMcQj1IZN6DlQW4yxDndCPhfOt4OT8GltO muV4V5nX8ljgE2aZJJixpkQJ/3bLX1VCWhRpOs4EUgaMH87L5emKN09amA/1EaeKW4zz+KH25 uorr6mpBk82SxgGwl6URgZdb2ZnrAinMw9FeopWCzUT2AiyhrN/roQvU/xxf5nSdk/tJZk22z RlrI7Db5Os7oe3flzrY9djQvfa47gmjiWqOYUiWNUY0ZW89WoSNz6eKd5NAmtMlbd4V+YOq0x 781qanyKEFhG3/P6tdTLOYb9POeJvc3NbFrFPD+eClwgIqomLrBd0EE4/zcX0PW6II3iEvqFj z++khdTxwgXspkL77mHamuksRMLTsKN6gAW/SeSNGbDsFZhHa1X5hYR4fqP4AJjSR1Q04r1dS xaTKYqgOlip7XOfzq0LqwviK/Pngx0AfH/lIjMGLiEuvkpQMr1a1VeokfyJolx4MDq0/cM+63 lfvp9TFHtRvzh2693QzpuWzMYI1xNuSBwRF3GQRJ+GjnCTGhWhy1fsXE46xIkGSjzE8k5KUM8 S5vLLX8J/9vjowGw5XMDgycPcEOCsIyBu39FoLgENxD6+eIzRkDPqQtRTFhbFkFAd/ct6OamT 4MWRKtCdF7CSaMCd2G40XTr039eODgaUgb3CJie+FVgajE/fyDF8JxTGvJJwTcgwHOl6sRN8i JKrQdlM4psS6AH1t8nkYVUjPbyuy0lRBB0ElxQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c index 6fd701db90c9..059eb3214328 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_kvdl.c @@ -270,6 +270,8 @@ static int mlxsw_sp_kvdl_part_init(struct mlxsw_sp *mlxsw_sp, case MLXSW_SP_KVDL_PART_LARGE_CHUNKS: resource_id = MLXSW_SP_RESOURCE_KVD_LINEAR_LARGE_CHUNKS; break; + default: + return -EINVAL; } err = devlink_resource_size_get(devlink, resource_id, &resource_size); -- 2.9.0