From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEB8A4436E; Fri, 12 Apr 2024 13:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712926993; cv=none; b=C9VAmy6FvwVm8cpFMuCwCuriCSJ4NryI11XT7/HDCBCU3vhj6lluze7G35Ggb3WrW/KLXL/4i/wgHZztY5SaIHif3ivbZxMbWpJvqP1IAYWh1MzTtX5CZ2FNgGVJFtwJYTLpswO7KKiCYoH7Rnx8aI9ey39iDyK7cV1rnKzR6Lo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712926993; c=relaxed/simple; bh=8wdevPfrdtepk0PCtS0tbraBxnU6ILXWXbU+kfU/aQ0=; h=Content-Type:MIME-Version:In-Reply-To:References:Subject:From:Cc: To:Date:Message-ID; b=l1uMaRBBcHxF8F2RhQbnr0z7H5s841xvQDjmhX+gnzLuLTZl9ovO6eJlTxDxdhqiv8JZU8hOjQ4Q3PVA999QXi18ZhM+cJQqWseXM64Firk0hJZ16WSOj6KsxJW5pqatFdrfij0R2H4Kd/LB9/hi5QSi/RvXxkJM+66IRVUa+Ec= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=awI6En4B; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="awI6En4B" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F856C113CC; Fri, 12 Apr 2024 13:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712926993; bh=8wdevPfrdtepk0PCtS0tbraBxnU6ILXWXbU+kfU/aQ0=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=awI6En4BnoNZRKhvZawTzXVzsV/D37RfCZWVwb0jDF/U9AMWf1YFeiczSz5Lh/Zl5 V3fWdznlkQSyZeB8AvsmqDewwWXIISMDenlbET0aoLX2zzeWeA1PfTKYh6lcdb/JYi G4UpelDztrOemmvQ+mbH/FjKboE/JfPRBfECavtTL38QibxOLqZMQ40NGUJosK3A8h 1Yy4pXxHAZB9xUayJCyeomyRO8ibLsjrfF2zljJAzqbgAmLDNym2vqjZKxkWBDA0dq f4rmv3QdM/IFJc2wY++J8r+a2bMBhMAcOhnCfLOBzxSvC2R5XTneHc9YLqLNS7XoQO akY2/Eo0aHpRg== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20240412104615.3779632-1-maxime.chevallier@bootlin.com> References: <20240412104615.3779632-1-maxime.chevallier@bootlin.com> Subject: Re: [PATCH net-next] net: phy: phy_link_topology: Handle NULL topologies From: Antoine Tenart Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?utf-8?q?K=C3=B6ry?= Maincent , Jesse Brandeburg , Marek =?utf-8?q?Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?utf-8?q?Nicol=C3=B2?= Veronese , Simon Horman , mwojtas@chromium.org, Nathan Chancellor To: Maxime Chevallier , davem@davemloft.net Date: Fri, 12 Apr 2024 15:03:10 +0200 Message-ID: <171292699033.4917.4025686054785818967@kwain> Hi Maxime, Quoting Maxime Chevallier (2024-04-12 12:46:14) >=20 > This patch fixes a commit that is in net-next, hence the net-next tag and= the > lack of "Fixes" tag. You can use Fixes: on net-next, that still helps to identify which commit is being fixed (eg. for reviews, while looking at the history, etc). > diff --git a/drivers/net/phy/phy_link_topology.c b/drivers/net/phy/phy_li= nk_topology.c > index 985941c5c558..0f3973f07fac 100644 > --- a/drivers/net/phy/phy_link_topology.c > +++ b/drivers/net/phy/phy_link_topology.c > @@ -42,6 +42,9 @@ int phy_link_topo_add_phy(struct phy_link_topology *top= o, > struct phy_device_node *pdn; > int ret; > =20 > + if (!topo) > + return 0; > + With that phy_sfp_connect_phy does not need to check the topo validity before calling phy_link_topo_add_phy. The other way around is fine too. > @@ -93,7 +96,12 @@ EXPORT_SYMBOL_GPL(phy_link_topo_add_phy); > void phy_link_topo_del_phy(struct phy_link_topology *topo, > struct phy_device *phy) > { > - struct phy_device_node *pdn =3D xa_erase(&topo->phys, phy->phyind= ex); > + struct phy_device_node *pdn; > + > + if (!topo) > + return; > + > + pdn =3D xa_erase(&topo->phys, phy->phyindex); Same here with phy_sfp_disconnect_phy. Thanks! Antoine