Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp994319yba; Thu, 4 Apr 2019 02:00:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLcgN1eT+7r2OoP5tGY5YA9ACLxPzHOfioKihYodeXVD87frb0ns3DPH9DfVaOpZl2SpMa X-Received: by 2002:a63:5150:: with SMTP id r16mr4406126pgl.307.1554368426486; Thu, 04 Apr 2019 02:00:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554368426; cv=none; d=google.com; s=arc-20160816; b=zo/WxLQDmfHl7lpuSag2fHHxGauTloS0k8XaMhyaAGneyMl3kbVHqaD0aSjPMA7Wm+ V4FY83jlggR52lqXSavNpi3ChDktYZjAbs2dIYngEVq2e7ZRnLYLZS7ATX95eQm46lnl jmoAgOIzMwNrCz+ZXAwyWz4qo35b/k3BPQperGMscHVioGbEsoV/3mQTkZCOlGzGB3A9 7bLDfYF7sN9XnTob98FTeg7DQGkJ/DbsOmd5dDCVbowN1DCJ/ogs/EJhJ3b2aYHyibR8 VrpxpxJZihF21APpn9w5RI/XI5Pphue1lzjMmHqiF+1oXs7LHV5XHNCWabe6YXsm5RIU Gjow== 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=kgAVrbhCKYoApM6KiIyPz90SAHYom1kh//7qvSsH+VE=; b=KwgMBXeA4gNPtspyB4qIeCrq9LpCG3I8YyZzCH5v6JxdWVKCaHOhPVcC/PKtLJh4i3 a2sb+35KOev/Jx+VxBQKOL9VMkWrsZH7j0UXfbjhjbxeEVkmP86BxxhKFQoYZ8keG1u3 fB0pH2VG7RJgskJMKPQDY7N1hnQ7OnF8rG2Tpk6oIR7aoVQwi7drBdfcwrVEXXZoi5Ns VcDREE4eDRUcS3dIlHug28i0M2Y/ifJQmaxkXhirm89lpTDbmdWDxJ9UTkBV2GoA79j/ vtw4eMRBJIDxiDTpgpkaNkZ3Q+2tJQejGKdnoNklZJ2Xamz3ixn0QGPgcKPltF125f84 ArcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="j/hvnhm3"; 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 j4si2874292pfc.101.2019.04.04.02.00.11; Thu, 04 Apr 2019 02:00:26 -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="j/hvnhm3"; 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 S1730429AbfDDI7f (ORCPT + 99 others); Thu, 4 Apr 2019 04:59:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:35878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731092AbfDDI7c (ORCPT ); Thu, 4 Apr 2019 04:59:32 -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 46B832183E; Thu, 4 Apr 2019 08:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368370; bh=7tCIUaCOVMNKGmg5rZqYdWrKf769vBqfoAsF8w53tO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/hvnhm3O4yEVCdlgHGzpgGH5G6wrn/Tu5uZ1foEmPME/0QzWMueP1IyvTJyWzVnS X/yPB6GV/zK59cvZlSre9fqpfX0tHazPJm+tgkGfAn0M7iRS35hrEnRAhBYjRixyIv zDdzEi/ljxUKsstId2rhIGz7uZKLIcrfW2nDbpJU= 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 4.19 015/187] net: stmmac: Avoid sometimes uninitialized Clang warnings Date: Thu, 4 Apr 2019 10:45:52 +0200 Message-Id: <20190404084603.808468469@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190404084603.119654039@linuxfoundation.org> References: <20190404084603.119654039@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 4.19-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 43ab9e905bed..886176be818e 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