From mboxrd@z Thu Jan 1 00:00:00 1970 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 403CEC4167B for ; Fri, 8 Dec 2023 04:24:17 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GNtVDXP+KXWJlT7d1cQXiFLNWmr+ynrIUYLHRuXslhs=; b=F+h6pj5uCYmEbW GWUIMLl9EHpstiUL+Wwun3BeCr5f0q12HS855D342f2ftqfJ93fcS+dlm02maW7N1QXz0VI+hyznH YBP9+mNqJJR067+sdPj6uSmfGDsG1vqCuQl58fqJCmXHgsMwURz/sWgLoCkR8gXjjIOeBQz1TeUuV TfO9yg1m5efqsrXPFJlxSjfaRWQOcQxEDC1F7KpD4/kRqsYqj2qDRSJUAMRtoBC/S4PdoWWCjsNmA 0guw0LbGDTl+9o1cydPqPRaElr8rqxA0q1KoYmLGRXOQl9qtB8t8bBxRbxay3F7UwKizaTKYi0tfR aUeZgf2X2dTME1P5rCfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rBSP1-00Eft9-1W; Fri, 08 Dec 2023 04:23:51 +0000 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rBSOy-00EfrD-12 for linux-arm-kernel@lists.infradead.org; Fri, 08 Dec 2023 04:23:49 +0000 Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-40c25973988so18201805e9.2 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=lists.infradead.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=nS2COlaq1hasfkPdBx0Qo7skhKddz7oEIzNmvke04B3PeGvZS5PPcviwttfXIjeNpR Ig0SbS9UsHhGzngC0mhRO0v84JB0VivW7i2iLRm/YbF9+rcd5rfpaUjTvi597rtztw3m ni7Uq6AWx8jNSgDPlqNBNmwq68xCzH1ncKceviYJ96WE7YGGFBNmpVWMUkJLWaVaUDXX xtHIcXudreBmIs5s+8Hc/efZDoPOqRqLXn/Ljiim9WBpApn70zyDZVwsDUI1zRuX0Ccv 0UmlWg0MSd/QA3v5WXZNOES2y3gJQj3Rh5h5dCmU4amG/5it9Pjnhjsu2vjfoNkusQyb 3ZGg== 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=IOBTn6UQ/fZxFTkWTiZMS0TtZ7dyBgDzds3Gzdn6qbSsRpE868yeTAblERIqjOBnFP nqoai+A8lr3jP9EO+BwnkwBd44DItbPQGF0zh2blYduruDgIzBmJgtKZJOEheWsLEtRi CyRmrAAB0doPEh+wnsxz2pEZWf7RKmgzEuyC2LqpmIbfO3IN10J8Zmya1dZagl5gvoaK yovrulxwMe8LWg1WfNcQS4gjdRKWbjXnT7m1GlhxK66waNR+vEsNkppiY59xtbLXGG+5 EYTCDjdQNzllZSNUQgCjz1k8pDc9ABkqwbX0zwJthK8eypAGCZEttcwy/A35a/63sghM oC7w== X-Gm-Message-State: AOJu0YwjWV7MJ2bKmrpWiBJ/pkrqknEuV2AAu9vvzR8L+dKxqhxHvyJE Nr6Dsfz5Mtis4qKvmm+r3/r5Jg== 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231207184015.u7uoyfhdxiyuw6hh@skbuf> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231207_202348_433470_8A87A875 X-CRM114-Status: GOOD ( 16.69 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel