From patchwork Wed Apr 17 16:29:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Wiedmann X-Patchwork-Id: 162405 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5702601jan; Wed, 17 Apr 2019 09:29:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhNK4C9Uh8TWzKp/XEc2xKH9y7/SzcX93HXEFlr4iGNaMXm0Q39BgDoqwwiM92OIbeXZY4 X-Received: by 2002:a17:902:6ac6:: with SMTP id i6mr703560plt.313.1555518566031; Wed, 17 Apr 2019 09:29:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555518566; cv=none; d=google.com; s=arc-20160816; b=gwMPVpqFxnTPCgHS/p3DM2f+6Ls3vwTg6xXoBeh5lsN01URtv1Gt+MX0wCoxW8Q/tz iUUwaiTvQcWvqtfrrcsYta6ZHBqGEM6Ooh+2qATmMNHLIP7xZB6wVvFL1gWrp401DZgz 99Gk5klfQNAIoJzvvUT6kczQf/b/oFJ/6VOHZgSBAnUyy6AGWt1pr3Tk29SXMwrj+HK7 l/kzv4s5YRZq6RDk3ICZv1Spag+16KB5kPq93sE7tpOPunT0ueJeAGbeSnEdC1M4aKdx OC9BhHpZ0cl7lGw0QOrgrecG72J68059HZU56NhpawXWJNUUmE8tx/01WhQEJ5FpVzzf VqAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=cHM9vcjnqAzSg8yUZAlFc0CbBWKNnz70xQciexaO6NA=; b=w1gjRstdI97Wg7zCGl/0V2Xv2pCzXD3gKkTgbGUFJebrPnrN409s/TjInIOs8NdeII 0I1mWzqm7syb2Pm2WOSBWZOH1Mzz55P9mIJIjLvF7bepLNPJYbVEBRTkV4nsRyl8YjNo ZjD6nxHWM9xsNKPJQ8Z54/XhGOZbhfENdoaZyjKDQflrxutQsRpZKcvcCPEcbORX6hsk yiDwr78NwmfKcDsGXbFdiyhbYXBHeejG0O4Bin6ZAOdzlD7NWLpUTo30Coy5yShY4aac 6d2vsOItwXtxgzo/T6uA89OxOlD8PGy0eiArMnX8pAyMaa3fZFlaEUd/G74j6nNjELOL Xlfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q8si49675621pgp.480.2019.04.17.09.29.25; Wed, 17 Apr 2019 09:29:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732636AbfDQQ3Y (ORCPT + 9 others); Wed, 17 Apr 2019 12:29:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33302 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729641AbfDQQ3Y (ORCPT ); Wed, 17 Apr 2019 12:29:24 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3HGOcX9013150 for ; Wed, 17 Apr 2019 12:29:23 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rx5xtn1h4-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 17 Apr 2019 12:29:22 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 17 Apr 2019 17:29:20 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 17 Apr 2019 17:29:18 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x3HGTGeK50266276 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Apr 2019 16:29:16 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62D71AE051; Wed, 17 Apr 2019 16:29:16 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0CF06AE056; Wed, 17 Apr 2019 16:29:16 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 17 Apr 2019 16:29:15 +0000 (GMT) From: Julian Wiedmann To: David Miller Cc: , , Martin Schwidefsky , Heiko Carstens , Stefan Raspl , Ursula Braun , Arnd Bergmann , Julian Wiedmann Subject: [PATCH net] s390: ctcm: fix ctcm_new_device error return code Date: Wed, 17 Apr 2019 18:29:13 +0200 X-Mailer: git-send-email 2.16.4 X-TM-AS-GCONF: 00 x-cbid: 19041716-4275-0000-0000-00000328F41B X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19041716-4276-0000-0000-000038382A51 Message-Id: <20190417162913.90238-1-jwi@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-04-17_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904170110 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Arnd Bergmann 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. Reviewed-by: Nathan Chancellor Signed-off-by: Arnd Bergmann Signed-off-by: Julian Wiedmann --- drivers/s390/net/ctcm_main.c | 1 + 1 file changed, 1 insertion(+) -- 2.16.4 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;