From patchwork Wed Jul 10 13:07:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 168805 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp9945590ilk; Wed, 10 Jul 2019 06:08:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/fJFmritTYMPW+ztIBUrkiM8Yo0QrDnIeowFojGCAVUzKsloriAR8Zj5pq1dzgIS4Y5yP X-Received: by 2002:a17:90a:d14b:: with SMTP id t11mr6905912pjw.79.1562764105857; Wed, 10 Jul 2019 06:08:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562764105; cv=none; d=google.com; s=arc-20160816; b=oP/KWaOE0caCcUZ+UoetkWTDjyaGLZC6senpUk/u5LN9TAOjmTE2i7Iqd3VppUgB1J 8/983OU3kye6H80UM9fJgl8GDpdhYSaskGami7z7P6CJuj74+C3FANvZA0wvFJ0ElGv7 K8u0UtsWAIgCtvwiNI2N14L0njjYe+WMsWcofbonTQi3A0IVWEZUzK8JkrFd0K/ujbGa t18bIJhgUMuE+3R7lJKe9lMKL/W/glNWqXeW4AQkxxhVRpTHlgZ9NW1WX6uQKEnYDOBW N6C6nIswCgaLCgrtzxBKBksSGH+bQdnEweIhIGuNPr5XiF80qCLgDYT+nVo8QxGABuLI yOYw== 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:mime-version :message-id:date:subject:cc:to:from; bh=v+fr6xFvA4WvZ/8zqldNB0wFzAd1WAOWhYDOvK+7Ck4=; b=uXca7bJgVVijfSkHQ924M6PH+V7PlGbYcc91X4vezrn5VzqjzPpDgP5guDhv5O+auF mUWhghQc1l2YK4OIv+oizCqXBXAkTLkv/Z1UebC1b33gXwwziPah9zYbZz3yivHsRBQq SnvFXod9cGRU7B5KVkTHKv2TRGoyy7XkGUpmpOTuLKCoGVRxU0OgaL1Qys1HMK05Tp/t 5VXXGt2blHhCQ+b1nPUDD4zeFUVR0Lf8wtr06FezCkQuBG5LklcPGDqEx0ofTVvsyM/W YSKVxMalan++tUgtA/NslolWj1snLTpL2Jnd1OHQjF2apYRpzdAIQHRBLp2usdfEioyJ kaSQ== 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 32si2080120plc.152.2019.07.10.06.08.25; Wed, 10 Jul 2019 06:08: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 S1727334AbfGJNIY (ORCPT + 30 others); Wed, 10 Jul 2019 09:08:24 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:52727 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbfGJNIY (ORCPT ); Wed, 10 Jul 2019 09:08:24 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MT9zD-1hvHLv1pVf-00UWdp; Wed, 10 Jul 2019 15:08:04 +0200 From: Arnd Bergmann To: Dennis Dalessandro , Mike Marciniszyn , Doug Ledford , Jason Gunthorpe Cc: Arnd Bergmann , Kamenee Arumugam , Jason Gunthorpe , Shamir Rabinovitch , Gal Pressman , Leon Romanovsky , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com Subject: [PATCH] [net-next] IB/hfi1: removed shadowed 'err' variable Date: Wed, 10 Jul 2019 15:07:51 +0200 Message-Id: <20190710130802.1878874-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:KkQQx8DbdUAeEoiZ4dYi+5NkNEKv2SgbU+HJttadWoj6WJJyCL6 sIVYpTHXvGhQ/eSTFB5EwdD+YKjqIhJKH2Tw4C7ZvviaK3SfFYkw5tF8WohilXIz6SjQ42U TlAyZSlmLeQ919CjlfeUBjm68ud+/2t2B8L+h8ACU+efARBFY2lVb+VA9jOM4t6swldiVW6 RH66axC5tDxrPc5gl30Gw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:zECRC6kMYdA=:9tSX5Ea1rKb7S91ddPQyVz gg/zpmly8nKnhW6vo+Tzvx62YfsMqTTNtQbjXn3lnxe7mnfGB94kmQ9QjpStn9EAuFL0U2e8+ O9qsKHjbM9caD/MoH6rwA1knKrwTrBizT2cd+86qkN65zaXcFMFnt80BeInYyND4Lqss3kQtZ 0xqbZvv/hhT3Vao1zVLwlag/DEdiZDdK8rPhNuLP199HCu4+1H1UlstaZpcRnIlw32qx0uLy7 kRMfQsJjclztQ4C7cob9ksh95ZqiXKfaCCE/Y/zfiFUP6mIzGpl66oHjQk8LXZvsXgRWj3zAb hLTm0nwW1OOi4vRqf/JhhQH3PVNVnRQYlOdLg36ynXSgaAgvbR0TbpJDglSwnaQf3W/vs+B5o ZLMRjDzZvlY4Uc0c3Ln3Md76EctKxwa4OuqZ6hRxHBumL+Nscu88XPZfh7aBdDG5D5btUGZfe 8W812KGMYFXclNdPApk9DsS1gfPoZdRQGa9e7Wl7NdQom55Nugj6/qOFlG6ttBwgGCfJcOeZ7 ZlcLPp53zzCfS0ZgPy0uPn8PMyNnraOkWp41XI8C31PqNAY67eDy1LhGCSnX91YfzsOJUfiY2 YtUyhwYXmxRCyINLWEm/j5kqVNNPYi4Is6ndt0kVcbeqKkTom/OwxPPxpJ37IvIVI61ykF030 0UK6Ce/PPFBrEM+xKEhXduLZTkhWUsbyT0Qq22mJU2NIOWKN5sulHle8xCeaJFslBQ5/gUPNb RxlvgFgvrrPGiD19ERpHdXshpvTFaaM7/M6J9Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As clang reports, rvt_create_cq() may return an uninitialized variable, because the 'err' variable is shadowed by another local declaration: drivers/infiniband/sw/rdmavt/cq.c:260:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (err) ^~~ drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs here return err; ^~~ drivers/infiniband/sw/rdmavt/cq.c:260:3: note: remove the 'if' if its condition is always false if (err) ^~~~~~~~ drivers/infiniband/sw/rdmavt/cq.c:253:7: warning: variable 'err' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!cq->ip) { ^~~~~~~ drivers/infiniband/sw/rdmavt/cq.c:310:9: note: uninitialized use occurs here return err; ^~~ drivers/infiniband/sw/rdmavt/cq.c:253:3: note: remove the 'if' if its condition is always false if (!cq->ip) { ^~~~~~~~~~~~~~ drivers/infiniband/sw/rdmavt/cq.c:211:9: note: initialize the variable 'err' to silence this warning int err; ^ = 0 I can't think of any reason for the inner variable declaration, so remove it to avoid the issue. Fixes: 239b0e52d8aa ("IB/hfi1: Move rvt_cq_wc struct into uapi directory") Signed-off-by: Arnd Bergmann --- drivers/infiniband/sw/rdmavt/cq.c | 2 -- 1 file changed, 2 deletions(-) -- 2.20.0 Acked-by: Mike Marciniszyn diff --git a/drivers/infiniband/sw/rdmavt/cq.c b/drivers/infiniband/sw/rdmavt/cq.c index fac87b13329d..a85571a4cf57 100644 --- a/drivers/infiniband/sw/rdmavt/cq.c +++ b/drivers/infiniband/sw/rdmavt/cq.c @@ -247,8 +247,6 @@ int rvt_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, * See rvt_mmap() for details. */ if (udata && udata->outlen >= sizeof(__u64)) { - int err; - cq->ip = rvt_create_mmap_info(rdi, sz, udata, u_wc); if (!cq->ip) { err = -ENOMEM;