From patchwork Thu Mar 23 14:55:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9641351 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89AFE601E9 for ; Thu, 23 Mar 2017 14:57:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AC3F20246 for ; Thu, 23 Mar 2017 14:57:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F25A27165; Thu, 23 Mar 2017 14:57:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3C4E20246 for ; Thu, 23 Mar 2017 14:57:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934301AbdCWO5T (ORCPT ); Thu, 23 Mar 2017 10:57:19 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:52700 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368AbdCWO5S (ORCPT ); Thu, 23 Mar 2017 10:57:18 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue005 [212.227.15.129]) with ESMTPA (Nemesis) id 0MUjoe-1ch5sq0Pjo-00YDQx; Thu, 23 Mar 2017 15:56:56 +0100 From: Arnd Bergmann To: Lijun Ou , "Wei Hu(Xavier)" , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Arnd Bergmann , Salil , "Dongdong Huang(Donald)" , Shaobo Xu , Stephen Boyd , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] infiniband: hns: avoid gcc-7.0.1 warning for uninitialized data Date: Thu, 23 Mar 2017 15:55:52 +0100 Message-Id: <20170323145610.54695-3-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170323145610.54695-1-arnd@arndb.de> References: <20170323145610.54695-1-arnd@arndb.de> X-Provags-ID: V03:K0:vF7/N5c6FPSshT2jPhGZVbOSHMo/TV7JVeBoMUsBFVYYrFa8iwD DYE0W2z2++uho1F8OB7N/QE7QFmVMnNUfznMqs1A87vk0lKe3QLfUVqyny2p2iSq7JrFZhY Mio18i5NQ76ZsJtP03AkGLRnB/GGXpA+65mjVLsBv/Ad/xEDhJ4JyFX+9/RznYSmND5tLFC pzvoGb/o9W/5xTlG1PDjw== X-UI-Out-Filterresults: notjunk:1; V01:K0:q8RrGlGw7mE=:q2b8O/8PyA7T9jnPOuzFek hVhNhsANHVnNC0octrqwh4Hmb1IlnJ7oWdkSxmrnvZ7MVgDZ8Lzg3dAQx7JNTCGnqQXRY2Z+x gGoIKFmIbzxeuZB2ln913+viDxobFwny0al7HCU/QGseRDfaJs8kWwspEFM4HJlo3e2hYUw6H wHN3ObjAvCsfZJYKt5facz7aKa2ebgjJtUI0hGCbyaVg8UOxnpL2fkZRzTeRuuqSwFDTHsTsa y4+MalJ5+r1QWnChznmpCzIcB+ohILZg/p5XPHY8JpxwMWNavUpHhDa/6KKhop6reqlDkSV00 U0xHo2wx7wNzN4bgaE5RaiViIjwGXgvpG8Pm+/4OHezZUpxprlQYq2WtxRzsnF8iDQeQJxQw7 QPALNoEcBf0pBwOn4CMjIN5YPp4iNS8LD0vCnlY7PpfCXZZXkddeMvp3n6vKkhfJEILw43+uG RduIciy1EcoJ0ztTPuoeoA4Foic1NAuQvYPq0dWimU6IxVfGLavbkasoiHHorlFPkWqQN9a3h 7U/gT4gCmCe5mLf99XH3oSwrg9qMilCKKBQDRs/AZfkly5HBaAQZa0HAo04j5uYUUTDA3HmKy 4I073KBmCLcvBGEyHvYx6/HP0YrGpZERqZ3QEsPh5xH+4cnq4spiPiM367edF8+6YuhA7psMg S1hyDn1fewgAXgVao641ucwWwrlBaoqUn/2vqxR798z9/+5wVWUPLLQaas7ytNHsvVjE= Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hns_roce_v1_cq_set_ci() calls roce_set_bit() on an uninitialized field, which will then change only a few of its bits, causing a warning with the latest gcc: infiniband/hw/hns/hns_roce_hw_v1.c: In function 'hns_roce_v1_cq_set_ci': infiniband/hw/hns/hns_roce_hw_v1.c:1854:23: error: 'doorbell[1]' is used uninitialized in this function [-Werror=uninitialized] roce_set_bit(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_HW_SYNS_S, 1); The code is actually correct since we always set all bits of the port_vlan field, but gcc correctly points out that the first access does contain uninitialized data. This initializes the field to zero first before setting the individual bits. Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver") Signed-off-by: Arnd Bergmann --- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c index ec68f56e8ee5..882073a6ec77 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v1.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v1.c @@ -1851,6 +1851,7 @@ void hns_roce_v1_cq_set_ci(struct hns_roce_cq *hr_cq, u32 cons_index) u32 doorbell[2]; doorbell[0] = cons_index & ((hr_cq->cq_depth << 1) - 1); + doorbell[1] = 0; roce_set_bit(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_HW_SYNS_S, 1); roce_set_field(doorbell[1], ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_CMD_M, ROCEE_DB_OTHERS_H_ROCEE_DB_OTH_CMD_S, 3);