Skip to content

Commit 3178d2b

Browse files
Michal Swiatkowskidavem330
authored andcommitted
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: 3849687 ("net: phy: Introduce ethernet link topology representation") Signed-off-by: Michal Swiatkowski <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3614bf9 commit 3178d2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/phy/phy_link_topology.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ int phy_link_topo_add_phy(struct net_device *dev,
7373
xa_limit_32b, &topo->next_phy_index,
7474
GFP_KERNEL);
7575

76-
if (ret)
76+
if (ret < 0)
7777
goto err;
7878

7979
return 0;

0 commit comments

Comments
 (0)