Commit 3178d2b0 authored by Michal Swiatkowski's avatar Michal Swiatkowski Committed by David S. Miller
Browse files

phy: fix xa_alloc_cyclic() error handling



xa_alloc_cyclic() can return 1, which isn't an error. To prevent
situation when the caller of this function will treat it as no error do
a check only for negative here.

Fixes: 38496878 ("net: phy: Introduce ethernet link topology representation")
Signed-off-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
Reviewed-by: default avatarMaxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3614bf90
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ int phy_link_topo_add_phy(struct net_device *dev,
				      xa_limit_32b, &topo->next_phy_index,
				      GFP_KERNEL);

	if (ret)
	if (ret < 0)
		goto err;

	return 0;