Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2112214rdb; Thu, 7 Dec 2023 20:24:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcFMIrpEPlMS+KRW5aDVz0YWXXKf83avrUywdxVm3q3w6rnKs/ColtwxgjcDIoGLuv1rQ9 X-Received: by 2002:a05:6808:1143:b0:3b8:98e1:5583 with SMTP id u3-20020a056808114300b003b898e15583mr4306681oiu.28.1702009440191; Thu, 07 Dec 2023 20:24:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702009440; cv=none; d=google.com; s=arc-20160816; b=XxBxNkq03Tm0cgWlpZ3HT3S3gCkcXgjkvbkbTllhXIiM109d1M10uZsdHzuxQ94NZ9 EfK2hLddD1Uz6RNhaXior/OgC7vTUvXUlX/1UO2Oyix64/Z31k5qUdc/0KhUhab17tjT gGAxp4Z5lY0rckZ/vxWST7dlUWBPk3hR2Cc4j6y2M1jPm6juuZPqKM36M40Y8CR17pGQ oNxzkR4EcPgxWS56gwNBCDD0EIB6kRFt8x+o+YqwYOT0oiSYXsRuK8feFTrAob0L7cXb 8386Ia2gprjjPiEjKbGZsThkerV/NASmNoWODMCqirMKyp6LQc8kMD54q7o7se5SNbHB ytcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=SPl6U0GokDKYjf8mFtBabOMqth1qqIW6W4U8DQpUoFQ=; fh=LD1hqZV/6qdBDNdPuOadtR3nxT6C9IW+s0Hoc1yZR2s=; b=LtGy7/AltLN5hSny+J2y4qNXYAeahAwQmePxRoC+FtdwcrjtqvP5ntOg/aVKxopwtG MU0TBaIKk4o0WZhRUQxBjXJWg0THNuwvds1BYEVd5WAkmXCccvyqsRQ388XYLAMor8gp RK7P2nGVALYU6kqgRFNz0rGFy5Clu7vO3qBQ991Rlv37a6yujZWHbFyEaUD7EjKjkOXL Of+X3Y6fuf1HFV78HOXtCBNKVR8UBTHt3NLdhYu/Vl9GvS6xvTUA17BBjAxTuHGPVIDF Abo/+DuazD7cFO/0RtUCNZ1wZCAp2+buidN0LbPOYySG+tZsFJ50mxDq1+Wg8jbi7k+4 Wk3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MbI5cu+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s3-20020a62e703000000b006cdd595606asi814512pfh.392.2023.12.07.20.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 20:24:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MbI5cu+v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9BD178347B40; Thu, 7 Dec 2023 20:23:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232077AbjLHEXl (ORCPT + 99 others); Thu, 7 Dec 2023 23:23:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbjLHEXk (ORCPT ); Thu, 7 Dec 2023 23:23:40 -0500 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BD9171F for ; Thu, 7 Dec 2023 20:23:45 -0800 (PST) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40b27726369so18391595e9.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=lyMAYRmBZfgPmT4mAO08n2f39mh+aEouq1+ATTbGypQ914DinnGROHxwXJfdv29Wm8 jKwLPRNmdz6EEmpbTN8UL3NEOUnLnIb4k9fGRYQXwA+IkkOpKpEJjggC7s+8NKIUBZ/T Q00KwUGMiw3Nje+iptASFkTziGkwhHR/ZY3/Udlys2ho8iLBsN+kth8HkDyR5ox1fgEz VyauQKauWOcGqlmPxSo1HKARDgW8HYD37CH+KB+OTzIaDs20ia22ypnzx+x62n80kPWu liwYX0dUpY3V7MC65yCy7YA6u8ltHcal+jEBiix9WFnB2x2kweubaIKKxZVs4MVYgYNG FF/g== X-Gm-Message-State: AOJu0YwI9DdFnM8GV5L/VQb1ixfPSX3QdZi6Fbi9jSUExB4W6LAUitLi kca5iIhKIIDyoAT99yv9mdUmqw== 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231207184015.u7uoyfhdxiyuw6hh@skbuf> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 20:23:57 -0800 (PST) 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