Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1020811yba; Thu, 4 Apr 2019 02:35:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiNoN00ngqW3wlvn+ultCNLXO2viJPem+ZkrZQAMj8udfb4qKgHP0rpMft3NVzuuJedENk X-Received: by 2002:a62:41dc:: with SMTP id g89mr4799772pfd.109.1554370548440; Thu, 04 Apr 2019 02:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554370548; cv=none; d=google.com; s=arc-20160816; b=U8ScWs88dqaiwSSHmAK5Y/3TZ0IkOV2ZwxzK3r7S3OfS74Q+snaA2pn25jua5EPWOX sCTSFncUPjtgLlGoC5ojmMg/PQr32/R3b9eG0XG3bALbwSVZ6Ow2kxrEghnLIs7893fp 8ovjJHxS3hXRwkTgxK9dpGy94s0Uq2O4vKfxt4pEjxWFJm8Wm4UuAxzBt4Nv1ju8Pipn FxR0ekGiVG/lbZavbfLE3aIbRAExN03Xf9MWwi0kjFNmj1O5c2mDECzw3kbcU9OKTxut BPhmmBvkIw8hKpyKE6vNENbuYrIUnFXO9lunsrqamR4rKDcyVN6Om7Yepa3AZdyVj6lZ 0atw== 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=+6mk/8BR0WK2leW1SLeEy7Wc65kHxJPIjz76boDu4yc=; b=WTUfGR+XRo8udaVHHeCDaEb2g/fvcEidsDLU+CIInyQfULqp6kDxXiQ8l4q44jN6cX fciyJIB7fxDaVqAvkun41EQTdEPVTIOZLWeievEJ7Ge9Y+4mPeoGZ5oyELG65JXGnrf/ kfEiDIC6kG8bfLYf0H/2bFYMll5aTek+b6uwkR7kpQ/TbrHAbE8KfCS9dQ0GrC5k9LSs gD6HKb1FLZWinjPo4DwlrGsB08s1aycFs1g3BLXTJ9nvP1hlH7DVsnINg22+0W0ltjGG 6FeLQdpir6FlX/a3KYKQGL5X1sQXi4mJJY+PVrybkpvQ+PsWc7LtPHK6RjgJQbX6gVXx HN6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IiomXQdG; 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 s7si11295049pgb.567.2019.04.04.02.35.33; Thu, 04 Apr 2019 02:35:48 -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=IiomXQdG; 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 S1732582AbfDDJeT (ORCPT + 99 others); Thu, 4 Apr 2019 05:34:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:46270 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732272AbfDDJH1 (ORCPT ); Thu, 4 Apr 2019 05:07:27 -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 AB96F218C3; Thu, 4 Apr 2019 09:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554368847; bh=9ekxfH/2yA015iu0SdQuGw7mv6F5tSSW9kC8MnEu9BU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IiomXQdGW+VRcxGptz0xJAo8K7tDoPcJbgkbTDj8TwDHwsLozemmYN6PG0DwYsfNB jY31UnxtrvSdVpUsgMK9PUlxrDPnadW/gIFE9A5kLzLChB5YqSs0EEBGs7zXJgL+u5 hratA4xl7K19YhGXKpP0N3LhkV8/ylN9WfwAF7mk= 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 184/187] net: stmmac: Avoid one more sometimes uninitialized Clang warning Date: Thu, 4 Apr 2019 10:48:41 +0200 Message-Id: <20190404084611.781416014@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 1f5d861f7fefa971b2c6e766f77932c86419a319 ] When building with -Wsometimes-uninitialized, Clang warns: drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable 'ns' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c:111:2: error: variable 'ns' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized] Clang is concerned with the use of stmmac_do_void_callback (which stmmac_get_systime wraps), as it may fail to initialize these values if the if condition was ever false (meaning the callback doesn't exist). It's not wrong because the callback is what initializes ns. While it's unlikely that the callback is going to disappear at some point and make that condition false, we can easily avoid this warning by zero initializing the variable. Link: https://github.com/ClangBuiltLinux/linux/issues/384 Fixes: df103170854e ("net: stmmac: Avoid sometimes uninitialized Clang warnings") Suggested-by: Nick Desaulniers Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c index 2293e21f789f..cc60b3fb0892 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c @@ -105,7 +105,7 @@ static int stmmac_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts) struct stmmac_priv *priv = container_of(ptp, struct stmmac_priv, ptp_clock_ops); unsigned long flags; - u64 ns; + u64 ns = 0; spin_lock_irqsave(&priv->ptp_lock, flags); stmmac_get_systime(priv, priv->ptpaddr, &ns); -- 2.19.1