Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3251468yba; Mon, 8 Apr 2019 14:35:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDDyoqiZxr9tHX4hI/tiIeh3p8Hsb6Eyy49AsyDn1tKv33lOIkiu1zcEVTHV/Sd5F11rv3 X-Received: by 2002:aa7:938b:: with SMTP id t11mr31700580pfe.67.1554759347017; Mon, 08 Apr 2019 14:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554759347; cv=none; d=google.com; s=arc-20160816; b=a+5DxKAofu3Il7VxWkWBIQxbKaGgxVDYrjbhvNFxNJLMFjq4beLVaPAcserD44sggB 5U65rYnt0tSBGb8jluXf2HdQkkaqMIVquVTeohoh15R7uhiQtMlZex2t+ZRF1InEFRzf L/Da9lwQnWwDjy1EpOP0wVO/FfKTTrxQcbIqhCKSTxagXA8y56NtQdDerBQNc+1WFtnU 3aM1bSqdxoeWb2W6x7GWIrFqixaA8nj9bU1Y9oV7uRpT2s0Q4Ug1bDe0XVzzzEeGlnMo 8qdei4N+7PAxE4EzYG2BIyWKHggmwm8ZgXS5/+hKivdfGO0FVTqIvBKVBoOuD55F3e+p zOdQ== 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 d4si18379629plr.301.2019.04.08.14.35.31; Mon, 08 Apr 2019 14:35:47 -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 S1729377AbfDHV23 (ORCPT + 99 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 Content-Transfer-Encoding: 8bit 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(+) 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; -- 2.20.0