Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp460748yba; Wed, 15 May 2019 04:30:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9yIfQAN7LlDT8e2WcdKadzMbi7pqAFxo/18KFNwbd2Vok4s0gnFhfLhPws78kquWJ/VK3 X-Received: by 2002:a62:ed1a:: with SMTP id u26mr39965431pfh.229.1557919852808; Wed, 15 May 2019 04:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557919852; cv=none; d=google.com; s=arc-20160816; b=D+pSSigGIhG5sZsnpK0I4ulEqhYMkIeig4cS04Yq0kEI7woCMLAYv/dns1GPBm3Aa1 cFuVq++DTymQaA9AdLVjXWvJnYYacafEhyFN4ttJqM81sykEFxABBxCPtCtnVfnQeKYL BFQnRusKXZ+qL3eWt35AlXMWHOk9U3sQf7MH9Hw7HD2Kkc0uXzlv2oQMkHS8ptKeWpvZ xlwDiOdySjX8INQdXFGPKiv/qn2TMt2T6I70FynjO7G7hrKgHu3GgTbfWVsJGS9b+aDT Ca7dzhDY1kF8nYU3ka4OTd+Ww7sMkAQBWbj1GzE1qNhLSkkkygTV+9bS8zLKGVyDfA80 kWfQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VPuzMv+iytuHYlbHXaIV69+MQloxe6YwaCN5Rr+zbTI=; b=x/fJigdREg/HhhDH2a/gc6NuF/wPNPLBMbMOnj2sIOUV41LG4VA9KsSsEavzr0MUwy Epkk58EK3vmbIJY1PlU7hG4sSlNnrovafBRjZq475Zc2yl4H4zRZRID9w+S7VqXm6lvN ++dNjSZ+AqBMSZi0JcrV0CG2kqQOiytgzY6G0RDqrTi2AZKRTWbSsyiDCFyyxYUbfRKl B/gKwCZkTnK17oa8mn9VrfjhRokYR3ADjQL6aCY1Aliw5WeaBZnsu/E9IRK7cNeUyD26 s06pFkoLreWSJ+5iiFM8pShbOZlFcyC++yV7o9ozxIXg4gDIP60oKvKgx185/6ktjO6/ 5UdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WbAbmEbt; 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 v20si1571954pgb.361.2019.05.15.04.30.38; Wed, 15 May 2019 04:30:52 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WbAbmEbt; 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 S1732466AbfEOL25 (ORCPT + 99 others); Wed, 15 May 2019 07:28:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:40068 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732455AbfEOL2y (ORCPT ); Wed, 15 May 2019 07:28:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EB77120818; Wed, 15 May 2019 11:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557919733; bh=0Fnyoql+kdy/sAypx07YxOWkmMw4biyzyM65/a7OMAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbAbmEbtO9nhIYS373egcRV8Q48OkhKRz5HIRSdmhaV5xO4+GHbUS40tgDTTfwt2a +c8UF1vGN6r6PnE4rY6dORrk0EJA5uW4Dfx9gwK/hqMUhyiYsEwAvTYSb4vpCWaP2V QG9RqPf1hY9BY0SBHoOiYKfCrrD8pH0h1s2KeNkQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Arnd Bergmann , Julian Wiedmann , "David S. Miller" , Sasha Levin Subject: [PATCH 5.0 071/137] s390: ctcm: fix ctcm_new_device error return code Date: Wed, 15 May 2019 12:55:52 +0200 Message-Id: <20190515090658.590949153@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090651.633556783@linuxfoundation.org> References: <20190515090651.633556783@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 27b141fc234a3670d21bd742c35d7205d03cbb3a ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 7617d21cb2960..f63c5c871d3dd 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.1