From patchwork Sat Jan 15 17:49:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 12714416 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47119C433EF for ; Sat, 15 Jan 2022 17:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hp/jPbNTcCu5cyUOpL4IZ3p6+UlVCZFrOLnFMFcXzcw=; b=YueZWOQ+xauWh1 WnC21ky5hPpYJsUvaUfHS/dORoGkEUSwHUCTZyaXK/nG/WMut0jOb6qiYwh7Br3XfMXegOzHapYU8 y6/kYg3YbPyibOUGKU0rj06gsIfvHJ5O7cxGP5ymU/T5T5DADcylmeqOgS5BvjQeKYBn638QRh0Io t8/flJ293VVGyffrabvlKi+m4jXI6+w7w1Jov1R4auK29h9D1QnR/bD4v7hW5//Isz1uLeH8+B8YX 1MR0EvBsAHX2u480SvrE4P3Uh08t4XByZ04J/SEgKx5LWXysNrTK8KnMmohEh8ARn1OeYtAxo0+bU 3XAU4Y/kbkiuW/nQwpWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8nBP-00BQJ7-Bv; Sat, 15 Jan 2022 17:49:43 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n8nBK-00BQHu-B4 for linux-arm-kernel@lists.infradead.org; Sat, 15 Jan 2022 17:49:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642268975; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5Ub1hbMwAGMv83XYOlhCXiwUBfOTPfG3vBCU3vhpmD4=; b=LnEno+ZEVtcKdth7EwZiAzeiJWxMXZTG3dti/5Y6JRG4tygFDpRlUN9vQCkwXc+YTsq45l nApgg1UwA0fd3H2qsfU6vYspzBv5TmXY9GFcciBZNRhGpetj2ra9RMH2nmPYVVxurXs9LW gYzZ1+bbqb+ndjdMv5Vz5fCJ4yY3maM= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-327-1o5w-T3uPW6qu-T0K_2yvA-1; Sat, 15 Jan 2022 12:49:33 -0500 X-MC-Unique: 1o5w-T3uPW6qu-T0K_2yvA-1 Received: by mail-ot1-f69.google.com with SMTP id j17-20020a9d7391000000b00591da2aff7bso2862870otk.8 for ; Sat, 15 Jan 2022 09:49:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5Ub1hbMwAGMv83XYOlhCXiwUBfOTPfG3vBCU3vhpmD4=; b=MX/k1Yj2WuodhtCOIbZBcur9cYTx7B5uwTqFOCY022vNjyD4ipl+iBd6QsQH63CcEn T4mFek2hvIewmsbxBtRS6dHE8sBd7ynWfrO6xZMbU9zYv6G/IMeda1GY7yBoU4Ww96e2 s49xUlvGHQlkPumKdJneSHqRBsByLu1gFoHMovZ/0XFQzjQw9JUNBMkl32JfXP1I4TVC J8thaNDIvCrrAVeZn8LJglbZHcw6AVt0csZIvz0NHq+mLGZtA1dIts4ttCTxF+0RDYwx MmYTnazS3e71xiMetfxVE+Z5BnTTVgFcR5NMyDprrJwECGTidYbLhrAeise3921+XqDm Wozg== X-Gm-Message-State: AOAM531rbnC7rN/Dz1mJqxujoox956D5zs/5F1YS2o13CgzTjhoXehsh 7GET01ePa0kWYKI++KDhxJWoWYut9nddBLNJpQciOTEoaMhc2gJGZExZFJGvchKw1y1c2jTUWcZ PWZ5/lWcjyi/2AYK34q/ph/9ZtSC0hSHrWGA= X-Received: by 2002:a9d:6d90:: with SMTP id x16mr10349759otp.104.1642268973022; Sat, 15 Jan 2022 09:49:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxR+KmHmEAcU1CSZCeT7bkPUleD6/z8y+Ucc7A0A1vb7OVK0PdYFegZBJKcQW1fj3jjvlhqdQ== X-Received: by 2002:a9d:6d90:: with SMTP id x16mr10349749otp.104.1642268972841; Sat, 15 Jan 2022 09:49:32 -0800 (PST) Received: from localhost.localdomain.com (024-205-208-113.res.spectrum.com. [24.205.208.113]) by smtp.gmail.com with ESMTPSA id w20sm3239438oti.69.2022.01.15.09.49.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jan 2022 09:49:32 -0800 (PST) From: trix@redhat.com To: nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, davem@davemloft.net, kuba@kernel.org, matthias.bgg@gmail.com, nathan@kernel.org, ndesaulniers@google.com, opensource@vdorst.com Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Tom Rix Subject: [PATCH v2] net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config() Date: Sat, 15 Jan 2022 09:49:18 -0800 Message-Id: <20220115174918.297002-1-trix@redhat.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220115_094938_483149_931E4331 X-CRM114-Status: GOOD ( 12.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Tom Rix Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates to a garbage value if (err) ^~~ err is not initialized and only conditionally set. So intitialize err. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Signed-off-by: Tom Rix --- v2: change to initializing drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index b67b4323cff08..f02d07ec5ccbf 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -267,7 +267,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, phylink_config); struct mtk_eth *eth = mac->hw; u32 mcr_cur, mcr_new, sid, i; - int val, ge_mode, err; + int val, ge_mode, err = 0; /* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&