From patchwork Fri Mar 24 22:02:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9644069 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 6D18E6020B for ; Fri, 24 Mar 2017 22:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B1E223E64 for ; Fri, 24 Mar 2017 22:03:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C08A2654B; Fri, 24 Mar 2017 22:03:41 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 4437823E64 for ; Fri, 24 Mar 2017 22:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753148AbdCXWDj (ORCPT ); Fri, 24 Mar 2017 18:03:39 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:61311 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbdCXWDi (ORCPT ); Fri, 24 Mar 2017 18:03:38 -0400 Received: from wuerfel.lan ([78.42.17.5]) by mrelayeu.kundenserver.de (mreue101 [212.227.15.145]) with ESMTPA (Nemesis) id 0M2551-1c39Ov0IAN-00u2Gl; Fri, 24 Mar 2017 23:03:10 +0100 From: Arnd Bergmann To: "David S . Miller" , Doug Ledford Cc: Arnd Bergmann , Lijun Ou , "Wei Hu(Xavier)" , Daode Huang , Kejian Yan , Qianqian Xie , Wei Yongjun , Yisen Zhuang , Salil Mehta , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [RESEND PATCH 3/3] infiniband: hns: avoid gcc-7.0.1 warning for uninitialized data Date: Fri, 24 Mar 2017 23:02:48 +0100 Message-Id: <20170324220250.2193128-2-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170324220250.2193128-1-arnd@arndb.de> References: <20170324220250.2193128-1-arnd@arndb.de> X-Provags-ID: V03:K0:9JiuPZ/tjsINeUKtx7hQBZXD5MVQfqM8eVmqlVR7emkmqM0y0W3 lRI1wyZu20vBMObI+997M5IUZhbzJL0xu7XQXMPU3ldUcPnKH9wG89mnkOAx+YxvAc2kzBD DpvClhoqFvfIgmaIL9A1ZbVWxTz8jzH7aLgmtWfzxO2PnBEXrMMGr5Tq7s6iu7Q5Ghq282k oit3BHqf3VpEX1V6oBG4g== X-UI-Out-Filterresults: notjunk:1; V01:K0:1XOW/e0jJdw=:0gAk7UgdeMf8zlnLMKz3XJ +Mzs9GsYNX9oVTFezIH/eej8NsycwPAU/uCEBZy5kKJ++X4YMbUydCOufMaXs3AdL5tzB36NN Z43B95qLN6Q3eAL5fb/AiEuyFEZYrD6ARRoQwkxJKMAIMzKsgfX1gP7XRtiRBoaOt8Yf87scB F67bzbKacj4gwK9eT5dHW2xi+UF7dRoZoVR2mQUwEntyLdb8JzUTLgu4IKValtD4C7mADN7ql eVtzFnmXCkFAqwiayIGOgxmifaXGAqJQATDhXUM0lNi0uooYbgoVzxPkXxW71jC0xmBTdXOAS eLEPX9GX1K8XjRO2NlbjM/+ltjulZ/p2umqSBK510FsLTQ3QVqsNN5fbRMeciDb2DCsQyPDQc VdBgSyMiSARmnblGFt2jjElfadPJghV638V33z8UUJPLK2XD1MTWJ2Uk4dEVC0I2WGmaTsbn6 IEPjNm8fGusaV3mdfEgD5bAOJB26bDy6qMKht1aCDmmsgikGzyE9PR0MfHZqv7QJdZkbkaUBL yLe54nwxJT4s6EpmXMPPGFrYWIW2Q5L3oGJRDeTACJmokm46VPXXEvnsB0qzQ85PaWy//Kl7I 1J6TA03nvbQfdEBGomqaifi9ZorZEIUjefBQzfpUnQD67yzsslQUD3yEWE8srVqmS8sgg8XuX JD71Rj8Xql5x9iCkF2Ptks4S47p354HsU2AAM9AtM4bqFUD8wbPw5FwJfzA6MbdtBZ/Y= 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);