From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934485AbdCWO5V (ORCPT ); Thu, 23 Mar 2017 10:57:21 -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 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.9.0