Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4659237imm; Mon, 17 Sep 2018 19:02:25 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb0erNbneg2ERzwJvltYkMoOCGqyIXV0yksmsu59KqnqsevyGW9jlnfxZgqjPoeHMpA5A4h X-Received: by 2002:a63:6183:: with SMTP id v125-v6mr26165100pgb.242.1537236145420; Mon, 17 Sep 2018 19:02:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537236145; cv=none; d=google.com; s=arc-20160816; b=MsvAmcNKoMxqNDbWXRYFZHotzlWokQPYuFahuQdrCdX8aSAxJbz3RcTb+n3IkujhYm /qlu1JaPm1e3X74/9579YjwpDkC9E8bdDlMGZP7ATpsUQpSPBvy6tXinj59DvSOQti/Y Lbd6pHlZLtz3MswePV5llPbzWcixBkDaQL7llwxvRXYj1bGfE82FSCQNQZhYW0HhA4JS sMPH2weOxGPC7f3Kbhxc/nNcXqOCNjZyuk8+T4+p9EtY/JTPCM4vBnt06kfTsP5TfaKw GsngUmV06Hf3RwDHXFTdCZWO8qQVH3fNEPWzvkCFaUqOQ0s4+Seh5TPNRhV+ZiR31VGV 07rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id; bh=yVCNxfCSdQ1s35MgaF6XljMDROWtw6u7iQ7B0ZIYUBc=; b=aOdFVe4WtTnuTA6RqgoIg47C4dKt14X8o/dy0FC//8e+uxOAngFtjxzBLDetyuOPla RyJpQLvpI6KdnYdBOUS+zaQwa+RODC+w8rfv64DNM8labmt1AQ3AqhJyH7gjqBrhCMjb FVROYsPAtXKlBEMx/xpfLuQn8g0OagVDXhmODaKyWl2xLyvEoHbA4PAVVRKAyGBZWuZ1 HZgRVlGvDLcgWFtN3lRUZEY8NhWrdftPKcV9ASB2RbKPge521I02wY0S2YPC/EWOO5vV sehE7RoiIFciYx4tGKn4UBZJamdHduviMPspEpYhA0PszezZJci5DBe8TCzzoww/iuD+ wyvw== 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 1-v6si17607672plo.96.2018.09.17.19.02.09; Mon, 17 Sep 2018 19:02:25 -0700 (PDT) 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 S1727544AbeIRHa4 (ORCPT + 99 others); Tue, 18 Sep 2018 03:30:56 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:12171 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725807AbeIRHa4 (ORCPT ); Tue, 18 Sep 2018 03:30:56 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id BEF1C34EBFD4E; Tue, 18 Sep 2018 10:00:44 +0800 (CST) Received: from [127.0.0.1] (10.177.29.68) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.399.0; Tue, 18 Sep 2018 10:00:41 +0800 Message-ID: <5BA05C48.4000700@huawei.com> Date: Tue, 18 Sep 2018 10:00:40 +0800 From: zhong jiang User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Michael Chan CC: Vasundhara Volam , David Miller , Netdev , open list Subject: Re: [PATCH] net: bnxt: Fix a uninitialized variable warning. References: <1537201883-2518-1-git-send-email-zhongjiang@huawei.com> In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.29.68] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/18 1:36, Michael Chan wrote: > On Mon, Sep 17, 2018 at 9:31 AM, zhong jiang wrote: >> Fix the following compile warning: >> >> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: ‘nvm_param.dir_type’ may be used uninitialized in this function [-Wmaybe-uninitialized] >> if (nvm_param.dir_type == BNXT_NVM_PORT_CFG) >> >> Signed-off-by: zhong jiang >> --- >> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >> index f3b9fbc..ab88217 100644 >> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c >> @@ -31,7 +31,7 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg, >> { >> struct hwrm_nvm_get_variable_input *req = msg; >> void *data_addr = NULL, *buf = NULL; >> - struct bnxt_dl_nvm_param nvm_param; >> + struct bnxt_dl_nvm_param nvm_param = {0}; >> int bytesize, idx = 0, rc, i; >> dma_addr_t data_dma_addr; >> > I think it is better to return error if there is no param_id match > after the for loop. The for loop will initialize nvm_param if there > is param_id match. Will do in v2. Thanks for review. Sincerely, zhong jiang