From patchwork Tue Oct 25 16:16:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9394981 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 6E6E36077A for ; Tue, 25 Oct 2016 16:17:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61BB4296BC for ; Tue, 25 Oct 2016 16:17:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55839296C6; Tue, 25 Oct 2016 16:17:20 +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 4ED6E296BC for ; Tue, 25 Oct 2016 16:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756387AbcJYQQp (ORCPT ); Tue, 25 Oct 2016 12:16:45 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:52388 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbcJYQQo (ORCPT ); Tue, 25 Oct 2016 12:16:44 -0400 Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MT3ze-1cNv2T2V8A-00S7U1; Tue, 25 Oct 2016 18:16:35 +0200 From: Arnd Bergmann To: Yishai Hadas Cc: Arnd Bergmann , "David S. Miller" , Jack Morgenstein , Or Gerlitz , Eran Ben Elisha , Moshe Shemesh , Christophe Jaillet , Moni Shoua , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/mlx4: avoid a -Wmaybe-uninitialize warning Date: Tue, 25 Oct 2016 18:16:20 +0200 Message-Id: <20161025161632.411899-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:4jxzUdDZUi677ONLknrWh8ty1UgP6m2IXkfB7dDvEVabSJ1APfX 5EA9GwoTQPdc0FQbeZVFIGNENUOhHDqf7cSEiJDN1MYdwT+5W+TRAx6KiTzdNvPOmJR78vH ePw9eGPwRUPOgsgJiUkqvTEkqEPJ/s3G57iZoBuAoUPd5z6nMHuaMTYfUHwMvD09nFRh47H ISbQUnRQ0LwjzHXKD7WnQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:ivZf2/mVemo=:Dbd5genJvn334Ir8Y67hnq c6eidEeI1UV5hTNEYSJFC0fo9gprRNmFQG2DxElxue81EzUBpBtxnOFbGD3zzgG/HsYmGzuJ/ YfXtubLHQEgrmALW8TPood6A5j7tNDFXz2tSq+HRgubAuLUGBiK0W/jRvJTHn5jwhXypSgMJP j6qyxZc8qYysWA8lM/92IT90oXYh8Nky4t5WpvRpyth8tNsddH2TI+RTEdQZURC2Uvoha34xY 3bi22sO1kkfxh7kbGQLmlVYO7XbWfGEPOD4OxNx9IQewRDVnRKkAk/mVVwxmeA+V3Xwi7tkwc 8hbq8bqUIqPwHvc0yl1SLDgPS5CuYjwzBcxVmPAjAgwTqYyhrsTMetnYEj3tcIvrfjBAAFGG+ J5slEKt5i1rppUNxgnOk+Qj4bT9zQeGx+xkig+hgVUxnaFuquLRtWOXNeppfYbBrUuy8Ltl4C y8FSWavkB1rn3BsT9KyeDUw/vkThoox+lE1Nnh6BytvxaE5iX0B28+MwX2xqtHKdyy1/OOHPh eHrGbjWfrUp70lob7CTzfUXpCZkr8exeB/yIfHq3tWop3gTu/e7LxIevHukdVNY6gv5429SgL GG2+bj+Wq9iSfMeGYKeVaSZC07bN0xnc1+hGMqMhQjKJJaUecgdiPCYgq6eKgY2nVPZeYap/j 1bCS6sp5XrU7ja9cZRLvBixVXtdoyaPw3788hD+RcXyMLnQHH/7YbDF8PY4MYlUGV7ViBSl3I JaXSRXmOZDIu5Hla 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 There is an old warning about mlx4_SW2HW_EQ_wrapper on x86: ethernet/mellanox/mlx4/resource_tracker.c: In function ‘mlx4_SW2HW_EQ_wrapper’: ethernet/mellanox/mlx4/resource_tracker.c:3071:10: error: ‘eq’ may be used uninitialized in this function [-Werror=maybe-uninitialized] The problem here is that gcc won't track the state of the variable across a spin_unlock. Moving the assignment out of the lock is safe here and avoids the warning. Signed-off-by: Arnd Bergmann Reviewed-by: Yishai Hadas --- drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 84d7857ccc27..c548beaaf910 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c @@ -1605,13 +1605,14 @@ static int eq_res_start_move_to(struct mlx4_dev *dev, int slave, int index, r->com.from_state = r->com.state; r->com.to_state = state; r->com.state = RES_EQ_BUSY; - if (eq) - *eq = r; } } spin_unlock_irq(mlx4_tlock(dev)); + if (!err && eq) + *eq = r; + return err; }