Received: by 10.223.185.116 with SMTP id b49csp2619637wrg; Sun, 25 Feb 2018 02:06:46 -0800 (PST) X-Google-Smtp-Source: AH8x2269k+owB+GuY0zWzR7dmfWiCWrAI2RNnmy+20v1pecpWyV8McN0Jl0xy28O55kHyDvTtAQm X-Received: by 10.99.167.2 with SMTP id d2mr5697266pgf.408.1519553206311; Sun, 25 Feb 2018 02:06:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519553206; cv=none; d=google.com; s=arc-20160816; b=qwvIWuXXuimSlYI2SBtFEPVFiupe8wEnb96KqDBV2SiCyuW6MGbCSq1x5KjIARCYpk U1MWfKIDH++FQu3kG3lH/WWS546/g/fHVaZIuoZ3isEOoS63mC/nkH+6KJq+sv3CthPv mtGlpa1rnAWBOXLWE5KeK3/+1QF4rcC8k3MzJ0Yjv4QuUxlI2ZInM8t223wmJaR+Dtum KS+4a4WnvOGQE2oeqvhddnB/DQ7w43ODzbL6E3KLfaQBWzbS7o5s7fVtkPuE/qODodUw glUrhkYt3bAM9z/B9Jdb2YgsUSxPbNKqA1gjW5WFqs/yZh7vaIu9w6naGhlytOFTiSVc 9cuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=hUbUvXojL9lcnko6BW1J2U8CGARj7oX7/Y6oa/LlkYM=; b=IPwLDfwoUzDtsr59jznvChUaiYKgrToGkWQ8/4Z2xOb0/DcUyfQM8ZogyfQqPyqWeJ Tw8KlthQLJqZw9Z5uQTAvruenx/sURsTw0jm5fWA8EdLa7D+8Wppv2p4WzEgxPgSmkHz Qo5JcdCJDWSk43oO09PBCstN78t/e0GZXs4lZjocWng+y3lis4Fkr7LHzYnFEfFWSacC PdBMhRCvxyJDzO5rUeLcx7fnPTjRKIa1xGV10pMZCmSy3Lwx+sIR5DQXg/OMIKH8tqGq KyQPItZMH2nzAy7X+mLTzkGHWV4l6oZ7584HAO85kHwpNP/knHUuNhe0g1nUNQ+k36oq UVLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=yu3+z43s; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u188si4076064pgb.648.2018.02.25.02.06.31; Sun, 25 Feb 2018 02:06:46 -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; dkim=pass header.i=@Mellanox.com header.s=selector1 header.b=yu3+z43s; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751798AbeBYKFJ (ORCPT + 99 others); Sun, 25 Feb 2018 05:05:09 -0500 Received: from mail-he1eur01on0086.outbound.protection.outlook.com ([104.47.0.86]:8331 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751558AbeBYKFF (ORCPT ); Sun, 25 Feb 2018 05:05:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hUbUvXojL9lcnko6BW1J2U8CGARj7oX7/Y6oa/LlkYM=; b=yu3+z43s42kZop6bsgv0T9MmPHPSbdhJ2yXnfKbWef5leo6CrHYjjbzA0VZFbjeCPEQBkAHYpgtYvJ+VCWpvWFUez5iVXcyZO6Lb8qXtBZNsH6mTNsjxxPDqSJS8hvA6Ib4u6WscZmSXoV/zSLUbKc0bT1tVN28DnG62s58rQJM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=arkadis@mellanox.com; Received: from localhost.localdomain (193.47.165.251) by VI1PR0501MB2461.eurprd05.prod.outlook.com (2603:10a6:800:68::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Sun, 25 Feb 2018 10:05:00 +0000 Subject: Re: [net-next PATCH 2/2] mlxsw: spectrum_kvdl: avoid uninitialized variable warning To: Arnd Bergmann , Jiri Pirko , Ido Schimmel Cc: "David S. Miller" , Wei Yongjun , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180223131540.1065413-1-arnd@arndb.de> <20180223131540.1065413-2-arnd@arndb.de> From: Arkadi Sharshevsky Message-ID: <907aca10-130b-3f2f-3960-eca019af3664@mellanox.com> Date: Sun, 25 Feb 2018 12:04:55 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180223131540.1065413-2-arnd@arndb.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [193.47.165.251] X-ClientProxiedBy: DB6PR0301CA0046.eurprd03.prod.outlook.com (2603:10a6:4:54::14) To VI1PR0501MB2461.eurprd05.prod.outlook.com (2603:10a6:800:68::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e53f15b2-79c4-43b5-bf8c-08d57c373bce X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(2017052603307)(7153060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zwY8UkepNMK3O0Cntk2IgGNkQR1cuN7WQi78BTZnoSAbGg/QSf5AypcXp34vGWHEv2K2a2IOTpNeGu1AiIaKlM1pf58GbGK/KlMtWsN7lo81tJVypT3lnk2VsyW2RshV4c+4CkTa3hhbK2fCgaX6lOqw7hsEmuMUjTg3UZPiB2JQTk9M1mtuI0bxX+ME0hRXKbOWPVfM2z2JSljYop/KQKbEE+UxRoE4FlW8LQCdIWn7VYwZGY8t2to0f38cUEbMCPZii73Zo81pNnOgHUHWkrLbEUpVRdRidsZkdSCz1+3r3L+XyndxyB6e1KLXsJP4VkEpAhCRtiDAse1a4Ex/HDYzFBHrzgew9+xH0bvXDhVxxI6Yd4zVbizejGCbaqQ7DcO/uEjBEiK6PJnfORm+24mn3Krn189i/i6WOF8ez;4:uSVHUmCRwgs4EElj3YxGVtpRDVi2RweYobPwJIihha7GadVp2W7WyhggEUvpo4qi1pAGJppKpb+miQrzMos+UrMrLij6mPAgXy5UHKF2PBlrzjH2o4xu34OeHOC9sKedYU71vPsIFNP2w9ly3vlJpMuFd9LVniaL/GlxPyOPzyK495h3feh/4ctOTYYWv10IXyZ1SIDeNSEtiQBT5MbGqlo4pHpjSYAWiO74qAvbC3/KrFvXtrI75Q5s1kWhAMaXR1AowNgFVnYexiSc0Jwv+A== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040501)(2401047)(5005006)(8121501046)(3231220)(944501161)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:VI1PR0501MB2461;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0501MB2461; X-Forefront-PRVS: 05947791E4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(366004)(376002)(39860400002)(396003)(346002)(39380400002)(199004)(189003)(64126003)(65806001)(6636002)(81166006)(4326008)(6246003)(25786009)(53936002)(23676004)(81156014)(8676002)(6666003)(86362001)(6512007)(305945005)(76176011)(58126008)(316002)(52146003)(2486003)(68736007)(230700001)(50466002)(6486002)(52116002)(7736002)(229853002)(8936002)(110136005)(54906003)(478600001)(5660300001)(31686004)(47776003)(106356001)(105586002)(6116002)(186003)(53546011)(6506007)(386003)(59450400001)(16526019)(2906002)(26005)(31696002)(65956001)(66066001)(2950100002)(97736004)(3846002)(36756003)(65826007);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0501MB2461;H:localhost.localdomain;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA1MDFNQjI0NjE7MjM6RzJmR2poTzBhVzJnR2lvKzliNEZnTWpk?= =?utf-8?B?ZzkybU5HeEt1RkhTVlRmenJEYW5tSUlISE9TcFF4Y3lBaHFiam9na3cveGRZ?= =?utf-8?B?NWpENndlZis2N3gxeHlPK3BSais0YUxYeFRtN3h6MzNnd0JvTFBMZnVkRTI1?= =?utf-8?B?MzhkL3lRYkxQakx2bnQzWFc1Skp4NVNxS0dZOFY1R0NpWVFvTlZwV0w5Mkto?= =?utf-8?B?dmRGb2lYUmc0ME1MOWZMTEw0alM1ZThNNkVuZDRJc1RHR0RYNm5nVEZ3aGZq?= =?utf-8?B?a09lU1pBUUtpc0tsZXo1eFdTY3VQM2xsVXZyUWhmRkRhSmY4N0trdkppbEQy?= =?utf-8?B?RXZiV3RDMnFtWFpEMFkyNlFnTE1CbWRmM0FicTNtQWIxMEROb1cwL3dGUk5Z?= =?utf-8?B?YUJXQkZYeStoaStIK2daUzVockZrazhiYWNvOVllYVFUbk1scXFNcXo0K2tp?= =?utf-8?B?YWhSMDRvS0VLSS95R1d3ai9EYzFZbGZtaHZ4UzFrV0Zz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nlbBjBIfSlj79QjD/XI2vF5WUhQK4vkw5qJVs8vjo6CueB+ocJy4FEi1noP0ZoP9+fKxfWEZVDB1SEpCZBj0K7VEP/CRC4Jf6wM=;24:F3zvAOWJVO3mwgq8ebLjOqh95NDaj01xZQx53OBENrWqISTJEZKl++NYHUjXcirejfvcfX6j/9U3J2igaFs8dtYEJ8QpS3MpiL4qdHc30tM=;7:qHYd9WqnsFr821CzIN4mxq2QyepoL9EmOUv/cini2+HymDmEbcI5RKPcYyaRvXfcT8rZxpJTd1KebYibYJ0Po51sPrrJc4LErmX1oZPyGq+oKNVib5RpA47qXk3rMycyNXu86+fae8nIYRH1HH2o0jsQToQSH7A+9Kv4yDywjunEG8iONXd5DViIO7Si5r5ENOE9Qc/U/N9RIv0qtjdRQ9UhFKPJbc+N+tk45lUPyD3gcnq6qN5ooPGs8e9btYYK SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2018 10:05:00.0462 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e53f15b2-79c4-43b5-bf8c-08d57c373bce X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0501MB2461 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/23/2018 03:15 PM, Arnd Bergmann wrote: > 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); > Acked-by: Arkadi Sharshevsky