From patchwork Mon Apr 8 21:26:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 161951 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4172420jan; Mon, 8 Apr 2019 14:28:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqz652EDxteraz4+oibZ5hzQ7s/spBst9dP/kOdunop7UYIes7Xl+TQYCdFKruqoYlUGH7BZ X-Received: by 2002:a62:121c:: with SMTP id a28mr32116002pfj.58.1554758911137; Mon, 08 Apr 2019 14:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554758911; cv=none; d=google.com; s=arc-20160816; b=eEHpYqnKcoTLy8LUHeBz/N0LgpgVtMc05r/4E5ijqjvbcmGDphIC8H/x7TZmr6TwZI MvmAiGify9XeaqOXzOl0HQZyDggg73zoKPPmMFuqtJhzf9UzxtYeZQJGHTmIwCsLvL15 /e/hoQFwT+efMNWlmlVKAuNcL5t+DE7z20OLmVQyFD747RnqkK4Tz64wjht0Yzlh55jx QH4lq97lfjhQafdDGQhvf2ovy8oDovAf6z9ZOo8gLmfF9Xf3XfGD28dm4juqYJ9Z/k3L t6n5dTZx801EhYGxiZ6crH346wwlM1YXodkW2we9AWFOX6FENJbQJEPqBOY+g3g9QEcb xVbA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iPjKeLjclfv/IworI/Ua17O1ZKQ/vu95GVemnxZryns=; b=1KkKAF04afyHwSd71epdux0YMj2pTM5OAvco/6b0aiXj9NP2tuSX/Ogf34x+JjMgEj q/0nuBxlt/dxXVzbNsGTNaIgZF6fN5lMncFyR5glIB5ha8Z0Tf8gnXmiyfKaSeadUPhJ c3W1fOv1Tj33kC/XFPblhtDe2/3mwpjRmToEM4LDQXnOyz2wtoUQ+9iRxEpX6IERublu EbSGJozywhwXbtbVqFAmmNiT2Zd1eDUN9FvLlBoRk3jBbr9HhNfxaR7yBoSsyom95VpP kbgu28FPr0nnrO+XrUDqpAC5utbtzUQdrJDUm0eljtXrhd87JwPyXA6K5SRFfL3A1RZx hNqA== 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 k3si17045048pgh.113.2019.04.08.14.28.30; Mon, 08 Apr 2019 14:28:31 -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 S1729382AbfDHV23 (ORCPT + 31 others); Mon, 8 Apr 2019 17:28:29 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:58909 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727107AbfDHV22 (ORCPT ); Mon, 8 Apr 2019 17:28:28 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1N79hs-1gqNNw0cE0-017YVU; Mon, 08 Apr 2019 23:28:20 +0200 From: Arnd Bergmann To: Martin Schwidefsky , Heiko Carstens , Julian Wiedmann , Ursula Braun Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , linux-s390@vger.kernel.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 06/12] s390: ctcm: fix ctcm_new_device error return code Date: Mon, 8 Apr 2019 23:26:19 +0200 Message-Id: <20190408212648.2407234-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190408212648.2407234-1-arnd@arndb.de> References: <20190408212648.2407234-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:o4R0ZM0QUffv2XWKmjETaIeLqeahjXhDfv7LnT6n8YxTPA6S0NM x7CLrqCeb4qpGvtBxSnGTMcLPtSuDa+P2z2FL836RfO4MafPSwAHpbZZjjI1x51B9ZlYZJQ RdDHPJYS6m/aa/D8Mz/PmOCbCDmQXxaR+rK46VHS3juby+nsLVwskD927zSappRIJz8lO3J SjC2UXvYJ0dFoEQH9FOUw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:okQOMoYWVSc=:E34AXOjUs0wa8pGzQKmvBs 9dtOmo/DWp1yFX1osWQSMjnJ4HeW7wUnkzHPo5imd7E9wn1efEIZqihcbOc9+WJ38NC0rzBBR Cy0S/w1syvbZxu+0QzyTcR8Ed+Q2jnpQtje6YeSqLEU5nNGj4/BrLgs7o8t4ssNiLWdpE+GSu 9CVw/jO8mBYzb7RnDJLgM5I/IVaghN88J+/x7VGJq2psD/0HceZnKN0k0fUGBw3ZbSaS2zumS sCAKHvET91+k28LkEFP26ve5o7jsnmYzByIu3mt+nLfjfwDIgx5K/rxntKaGAXYnvkt1g3ts4 0NmazKY+WWpRMzmFOAAJ6pjkCP0vNXe6Kll4dBzDhoxUFD8oIP+dwk6C22pR/AQN3RUgWABss rW3ua+0i+Jada21l1mvg9MicG0E0/ZTBQ4/eN3Cp6HQ/a8jHym6xUJRlk743H1HNilsEOCgnm c6UilGcO5QwgoBJlTIs0CHfwBQpaFJlL6KWxvNXgET1F7x7T36nSJZMBXBRdixfnsIrJBmtVw qs61b0dj49tVa1jMegFFSx/yxTeQG8mZRtfk80XkWIp1W9mGEhsWVrXAsHQXJ0qaTYRimDjtn FSTPEJgxvTqPQtjXpFTOl3EUtZ2MHv4U1M8B07O6QGPt1icGcCjporwPEjmp8TNDW6RLJiPTh 4JcHuz27tKUg20D3kEEUhfY4Q4ryouabhPSgqriZWc96Zj3H6JnC7awh3+W2/tAaD6OyMk+YY 9LXpNiDqzzwOEt6jmWnRcYTgedN1XfumL7Fs9A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org clang points out that the return code from this function is undefined for one of the error paths: ../drivers/s390/net/ctcm_main.c:1595:7: warning: variable 'result' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (priv->channel[direction] == NULL) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/s390/net/ctcm_main.c:1638:9: note: uninitialized use occurs here return result; ^~~~~~ ../drivers/s390/net/ctcm_main.c:1595:3: note: remove the 'if' if its condition is always false if (priv->channel[direction] == NULL) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/s390/net/ctcm_main.c:1539:12: note: initialize the variable 'result' to silence this warning int result; ^ Make it return -ENODEV here, as in the related failure cases. gcc has a known bug in underreporting some of these warnings when it has already eliminated the assignment of the return code based on some earlier optimization step. Signed-off-by: Arnd Bergmann --- drivers/s390/net/ctcm_main.c | 1 + 1 file changed, 1 insertion(+) -- 2.20.0 Reviewed-by: Nathan Chancellor diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 7617d21cb296..f63c5c871d3d 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -1595,6 +1595,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) if (priv->channel[direction] == NULL) { if (direction == CTCM_WRITE) channel_free(priv->channel[CTCM_READ]); + result = -ENODEV; goto out_dev; } priv->channel[direction]->netdev = dev;