From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MbI5cu+v" Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 560C3171C for ; Thu, 7 Dec 2023 20:23:45 -0800 (PST) Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-40b27726369so18391585e9.0 for ; Thu, 07 Dec 2023 20:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702009424; x=1702614224; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=SPl6U0GokDKYjf8mFtBabOMqth1qqIW6W4U8DQpUoFQ=; b=MbI5cu+vG+FkNB6axRSRHqcLezZQ8RXfRcUsyzkVlOnlrkTFke8AZL6p4RHnrQ+kaj 7lfDbYl62k0qRqFJ6uJw25+vDB0uNQDQSS0BZMfw0wYsc2H51tC2YpqPmU+jcI6jeYqg Wgp/qryjFiM6r7thcyyKt+5DpEXCmEZswmVlTfnxD6m+HLGVFkBMsYCr20+3pHwWNjLG 33sz7QubTOf6RUmOuENNp8aYF6z0KJA2LKTKVHJy2mMmUwcWF0Cye6lraw47UNYnQOCs En6OTXoo5F/VkRXcXUD7TllTmVIjM2fd2BFCdZ43Tmt9SlQgqDF6KfcrTUwBkKlw5h8+ grWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702009424; x=1702614224; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=SPl6U0GokDKYjf8mFtBabOMqth1qqIW6W4U8DQpUoFQ=; b=IYmmkxAfcSx46ev2I6DU3K9fQjbw/1x+ezoD5kvUiS5zEjY0K2VCWIICvcpjkMu1G6 1234l3kQqGDG0xm13f9eeY/OmkjreWSVft2M5gxfCaX5zYXCUGVOrok4HsThVZWEcxVh CnkssZOoka6w1VfmOrGuxIKaw2K+KmAkEZCj9cj33tK5ekEKGWthndJGaLlAqJ5PItu1 tPsTWjvZS7GVXKG7XC5jSIhiYDlE5Vkut3cPmkJmZkeGig8kScz3e8FJ4XIA3Tbqps4X S7h1J5tp7QtY7iFMWvZ36zCIqjabjxU6qQXaoQDT0Kl1ReSbi4DOi+BM5BKtcSE2aGsW VU4w== X-Gm-Message-State: AOJu0YyeDb4qcaTY2JKploL5RMci9PVmn8Cwcm3F5IeqUcw34zOKKB8q xeedGIGwo4fRsMtxlJznbHfAsA== X-Google-Smtp-Source: AGHT+IGb8HNYcf4CwqR2mNQtwvE2sIxWS6ha8l/UWovNTRhq1viL+9jJuZvP6Uejra7pVJ3NHVKIxA== X-Received: by 2002:a05:600c:4651:b0:40c:2518:687c with SMTP id n17-20020a05600c465100b0040c2518687cmr1507452wmo.61.1702009423621; Thu, 07 Dec 2023 20:23:43 -0800 (PST) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id gw18-20020a05600c851200b004063c9f68f2sm1470710wmb.26.2023.12.07.20.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 20:23:43 -0800 (PST) Date: Fri, 8 Dec 2023 07:23:38 +0300 From: Dan Carpenter To: Vladimir Oltean Cc: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= , Simon Horman , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Frank Wunderlich , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com Subject: Re: [PATCH net-next 07/15] net: dsa: mt7530: do not run mt7530_setup_port5() if port 5 is disabled Message-ID: <9b729dab-aebc-4c0c-a5e1-164845cd0948@suswa.mountain> References: <20231118123205.266819-1-arinc.unal@arinc9.com> <20231118123205.266819-8-arinc.unal@arinc9.com> <20231121185358.GA16629@kernel.org> <90fde560-054e-4188-b15c-df2e082d3e33@moroto.mountain> <20231207184015.u7uoyfhdxiyuw6hh@skbuf> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231207184015.u7uoyfhdxiyuw6hh@skbuf> On Thu, Dec 07, 2023 at 08:40:15PM +0200, Vladimir Oltean wrote: > > We could be more pragmatic about this whole sparse false positive warning, > and just move the "if" block which calls mt7530_setup_port5() right > after the priv->p5_intf_sel assignments, instead of waiting to "break;" > from the for_each_child_of_node() loop. > > for_each_child_of_node(dn, mac_np) { > if (!of_device_is_compatible(mac_np, > "mediatek,eth-mac")) > continue; > > ret = of_property_read_u32(mac_np, "reg", &id); > if (ret < 0 || id != 1) > continue; > > phy_node = of_parse_phandle(mac_np, "phy-handle", 0); > if (!phy_node) > continue; > > if (phy_node->parent == priv->dev->of_node->parent) { > ret = of_get_phy_mode(mac_np, &interface); > if (ret && ret != -ENODEV) { > of_node_put(mac_np); > of_node_put(phy_node); > return ret; > } > id = of_mdio_parse_addr(ds->dev, phy_node); > if (id == 0) > priv->p5_intf_sel = P5_INTF_SEL_PHY_P0; > if (id == 4) > priv->p5_intf_sel = P5_INTF_SEL_PHY_P4; > > if (priv->p5_intf_sel == P5_INTF_SEL_PHY_P0 || <---- here > priv->p5_intf_sel == P5_INTF_SEL_PHY_P4) > mt7530_setup_port5(ds, interface); This doesn't solve the problem that Smatch doesn't know what the original value of priv->p5_intf_sel. And also I don't like this code because now we call mt7530_setup_port5() on every iteration after we find the first P5_INTF_SEL_PHY_P0. > } > of_node_put(mac_np); > of_node_put(phy_node); > break; > } Let's not worry too much about false positives. We can just ignore them. There is always a trade off between false positives and false negatives. With GCC we try to get a clean run with no warnings, but with Smatch I'm targetting the false positive ratio at "this is worth reviewing one time." regards, dan carpenter