Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3302278yba; Mon, 8 Apr 2019 15:54:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3x6aXZZdlEexlCD8PjwatpoSbDEKmmzryQo/0+VkPHGIw07QcaBCszW3pRX73hCVW2n6F X-Received: by 2002:a17:902:d68d:: with SMTP id v13mr33389585ply.55.1554764049525; Mon, 08 Apr 2019 15:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554764049; cv=none; d=google.com; s=arc-20160816; b=dRswJ4G76qDcMIfFF6k6Mvu5WCFZvYD1jShDah37/eQ6EBhQVNRTeipg1R28YDfXoB qf8RU3YWVIErL64qasU2wm10xc/la+8WgLz1FE1ecAcC1ZRWjBTZBHTb+Z8NRR1lciDg 3ZqZBiXPvkp0X4YH3pw5uqJQSPLXTMM4GinZwIYq1z6rTirOGC/JMsZX0o5FkkJbSwq6 xG6c0VLVIfQOiJFUqUC5DwNA4eKI4wvIvT1DSCXzWe1haOBLXirpKAfLi3j4Pj0Xtbom doFcItOLSJJQsJZiPSPG6CFaiYghc2ZUgGQH70kpnBs6sPMGj48Jrz1DEDxKucjt7rkS LVkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/zZ6MqEe/5u/116LxAogiG2NpDwuN4xleJLV8b87cz0=; b=YpnrMkbhbw4W9tRfFFoYGh+Zc0goIEKg3bb6zhApfQhD1YO/cPwojE8FQv/7OEGeOm 2YtK174ac7MNZddzaoaEn2lzHmUPjECOuzyiuF3B0x7B5NtpFv6G7fkLPheh/sqPUrYt B6R6AxKE0RBFRvrotQkml7axtjGTH0fRjBqZYbcu8XOmYU4KrfmsOdYhuQs8J95i8UfT 7P0b/UUBiZZFFymLK9IrhpeDMTlWYC/aJx5S2YCUvOif5gPaBHkuumJQN6rTY4DuLt9Y h0mpDqAavadsmosmqL41SWappJVrcnPOM1FuFTdCxbkP/hW+EOPOQyWrmhD100zTviDW Jj9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nbUrc8a0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si10086749pfi.165.2019.04.08.15.53.53; Mon, 08 Apr 2019 15:54:09 -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=@gmail.com header.s=20161025 header.b=nbUrc8a0; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbfDHWdj (ORCPT + 99 others); Mon, 8 Apr 2019 18:33:39 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35574 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726068AbfDHWdi (ORCPT ); Mon, 8 Apr 2019 18:33:38 -0400 Received: by mail-ed1-f65.google.com with SMTP id s39so13179224edb.2; Mon, 08 Apr 2019 15:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/zZ6MqEe/5u/116LxAogiG2NpDwuN4xleJLV8b87cz0=; b=nbUrc8a0BU8kBk7BiAqI+GrUztZRfylvmbsEGy2QhunADpk8S6VHI4KeKyeubCXPey JYAThEx05tzwJqktCKr5AXks5pt72CQwc1ZV+rBXoj7aOzKGaLMJZU3p28753Yafs20l X97E5lW6eq0Ko9cQ9FJvNzlRw7N2hTZf9ELRHKcVccUbZYzrXYLOUAy7lPCJowOkSJ5p o2th9g491vCpaTCmdtn82IFQgolSl8V6hKLyNRSXafIOyTN4ajsgsMHmpaS2mkS3A4W5 NkpYmBW19E7JRqvuzOL0VyA3JXN44btf+RKzeVkL4K6HZuOi6JvsCFSdSu2hVABCvtip ftzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/zZ6MqEe/5u/116LxAogiG2NpDwuN4xleJLV8b87cz0=; b=IsHuw2NsQ7wx489+Rrk8SmKZG6YYuroSshxuaBicv8YLuYW2zhFq/m9OCYDa9Ozgat uSHJ/U9jR0wrcjY9Pl66nMFzkaNXs/dfFTvdx/pWXHiOmjYFLUlr2g7vBNU1gc/HJOG4 Dhu+TggvOqgjLrVkml7g1cvNBrCNX/v93/ccvkkxCeqMZA5VqvA1Tg7eBFG06G3sLwdB rO4MIcjz3Np2NR89sSuykG5gXMmQm4fZgWctBYLLfmcGy27qTqNHJPebZiPofUeSdczV 1oznkInzz+t9WcfLuKf+45QPO1Wp6M7Ncg2/my/oG6XFjMsAlBUmI4UebDNXR5zh9kDD BdIA== X-Gm-Message-State: APjAAAWSoIpG3q3zZDhazxZX3oY5d4YX34rbVLq3+Q12B1gLsysRn8DC OOfkYEXUdNgcwsrEgs2pDMI= X-Received: by 2002:a50:a4aa:: with SMTP id w39mr20865551edb.206.1554762817169; Mon, 08 Apr 2019 15:33:37 -0700 (PDT) Received: from archlinux-i9 ([2a01:4f9:2b:2b84::2]) by smtp.gmail.com with ESMTPSA id w58sm9213684edd.69.2019.04.08.15.33.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Apr 2019 15:33:36 -0700 (PDT) Date: Mon, 8 Apr 2019 15:33:34 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Martin Schwidefsky , Heiko Carstens , Julian Wiedmann , Ursula Braun , clang-built-linux@googlegroups.com, Nick Desaulniers , linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/12] s390: ctcm: fix ctcm_new_device error return code Message-ID: <20190408223334.GD18333@archlinux-i9> References: <20190408212648.2407234-1-arnd@arndb.de> <20190408212648.2407234-6-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190408212648.2407234-6-arnd@arndb.de> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 08, 2019 at 11:26:19PM +0200, Arnd Bergmann wrote: > 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 Reviewed-by: Nathan Chancellor > --- > 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 >