From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FC61C04E53 for ; Wed, 15 May 2019 12:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40A0C2084A for ; Wed, 15 May 2019 12:01:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557921671; bh=Sqre4+W0dfk+YkgD2o79RpVqoU8yw9v+ixeml1EpZHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=m+r1QlRvjAPZSFaopB7RcfjhEYEI1HbQE7R45aJtbB+pbg8lXEWjWk9Z+7dH1B2RL 0OR0RtxXEsIZr8ceV7xEQX1uZQaIRfgtfjPvIgHi2u++QJen+kfhLDT6w4JCO2LYBF EgZT617mKCe3VVHn45BRnnzrJXotFe1Xi8WrDMCk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730075AbfEOLOL (ORCPT ); Wed, 15 May 2019 07:14:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:50178 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730085AbfEOLOL (ORCPT ); Wed, 15 May 2019 07:14:11 -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 0804E20644; Wed, 15 May 2019 11:14:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557918850; bh=Sqre4+W0dfk+YkgD2o79RpVqoU8yw9v+ixeml1EpZHA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s4+XOn/BMsz5ebJ9M1oDPtHtey0eVW9FQU9VodyC4yftF5Qd+LHXZ1fpgdTCpNnNP qtbI9Irsy1HlUtiFbxyJ+wELn7K/9srYm2IBG5yOb3b36Uwdbmj/mITPdJAaYEgt96 gSGUS7dhN8EfTSiPiyV4fMQXSCZXu/QQ569mIZdA= 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 4.9 23/51] s390: ctcm: fix ctcm_new_device error return code Date: Wed, 15 May 2019 12:55:58 +0200 Message-Id: <20190515090623.961966830@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090616.669619870@linuxfoundation.org> References: <20190515090616.669619870@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 ad17fc5883f61..e22b9ac3e564f 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