Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1019246yba; Thu, 4 Apr 2019 02:33:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqFDBxv3oW3SsDSLHit4HuZ2OdDvrDjrNfSqw4rPQOFFVJ6teyINlHE3dn4i+wm946Hjgi X-Received: by 2002:a62:b612:: with SMTP id j18mr4890028pff.124.1554370423766; Thu, 04 Apr 2019 02:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370423; cv=none; d=google.com; s=arc-20160816; b=vc0VHfJbgWC+hA9pmLiYN2mGnKvdRIIm5Gi8lb7NPg3lLKyi0BMezDXrcJPlZ/CTZj +S5xnGwrkQASLlLA+0oniMFvs59MaiMfr6Lhq86MRdeU2gaCeNwm0lTTirjXrYxGHmmU NJTrkMrLKVAbtw4gYX977B9SRsU7zCKk83IDsNxPtP4St7wPXby5Su7NE0bKeeWldDXH VG/gUF+HOdQVtTSBZLV6yxZnVGI3HJVZzxb5zoWnOKjYI4hww0gbtFzUYCHJqyqGD3Sc NM8wgOB45HWA088nmBEaB+y8mrGigFNdzqgrjhbCjxGdd1jtgQGAh56h6WhVM8qw+keq Ve0Q== 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=mcGSaKx5PW7+Kol/nzPvV2NMh60gXHleeOXJk1yIix0=; b=hDXJxmeJBGqsw4loMOJVk9jUs/H3lwoXGDW4bQSqn/fH1RDp4958dEZlGIg4kUZtjL 5Nia8vkO8pgEDIUALdheO2C2mDMLWKy7jXs7gy+oFK45DtA/RaXsnK7VdHNDsU6w7SfK kmMH3eWdQpxjtzAtUnLSPsAc6YiNnVnde3cDFUg7FLEjA85vkJmJYibVnR+V18+3cHA3 q3nR0J9TnvErNdqeGMDjV5mTxiMaM+iEPDMLp0CPXy6gy8maTJJSENaZUn0NBdHPIhX9 5Rw1S1is/ssaUp6oZmvEfui7IDPbTklHVtwAiumtN4RUJKyaxoG0ZkiU+xIMVErZi+/S 9snA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="oTLR1O/c"; 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 138si15384550pfa.199.2019.04.04.02.33.28; Thu, 04 Apr 2019 02:33:43 -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="oTLR1O/c"; 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 S1732774AbfDDJc0 (ORCPT + 99 others); Thu, 4 Apr 2019 05:32:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:47972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732722AbfDDJIw (ORCPT ); Thu, 4 Apr 2019 05:08:52 -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 890D62186A; Thu, 4 Apr 2019 09:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368931; bh=8pZKyeHvzoHYM+Wagxl1rFSJP1QwdutGa6Jx3W0N3LE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oTLR1O/cbTmoqqvQ1W4mHW/sVVHkTzp6WAluHNEqEUmdzqrbIfPTOHNrG7qMJf7+6 shKnPeUt4D/+HdlEHHKsEtbQ5pYd3w0jL5fXw7qGr6wILB7iX5jIUSaIxk7jePSRvQ wcao6fbxY2WMT42V461esDITyU0C9e2CviPtQo14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Desaulniers , Nathan Chancellor , "David S. Miller" , Sasha Levin Subject: [PATCH 5.0 018/246] net: stmmac: Avoid sometimes uninitialized Clang warnings Date: Thu, 4 Apr 2019 10:45:18 +0200 Message-Id: <20190404084619.803637247@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084619.236418459@linuxfoundation.org> References: <20190404084619.236418459@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 5.0-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit df103170854e87124ee7bdd2bca64b178e653f97 ] When building with -Wsometimes-uninitialized, Clang warns: drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:495:3: warning: variable 'ns' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:495:3: warning: variable 'ns' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:532:3: warning: variable 'ns' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:532:3: warning: variable 'ns' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:741:3: warning: variable 'sec_inc' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:741:3: warning: variable 'sec_inc' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized] Clang is concerned with the use of stmmac_do_void_callback (which stmmac_get_timestamp and stmmac_config_sub_second_increment wrap), as it may fail to initialize these values if the if condition was ever false (meaning the callbacks don't exist). It's not wrong because the callbacks (get_timestamp and config_sub_second_increment respectively) are the ones that initialize the variables. While it's unlikely that the callbacks are ever going to disappear and make that condition false, we can easily avoid this warning by zero initialize the variables. Link: https://github.com/ClangBuiltLinux/linux/issues/384 Suggested-by: Nick Desaulniers Reviewed-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 685d20472358..019ab99e65bb 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -474,7 +474,7 @@ static void stmmac_get_tx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, struct sk_buff *skb) { struct skb_shared_hwtstamps shhwtstamp; - u64 ns; + u64 ns = 0; if (!priv->hwts_tx_en) return; @@ -513,7 +513,7 @@ static void stmmac_get_rx_hwtstamp(struct stmmac_priv *priv, struct dma_desc *p, { struct skb_shared_hwtstamps *shhwtstamp = NULL; struct dma_desc *desc = p; - u64 ns; + u64 ns = 0; if (!priv->hwts_rx_en) return; @@ -558,8 +558,8 @@ static int stmmac_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr) u32 snap_type_sel = 0; u32 ts_master_en = 0; u32 ts_event_en = 0; + u32 sec_inc = 0; u32 value = 0; - u32 sec_inc; bool xmac; xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac; -- 2.19.1