Skip to content

Commit d9c743b

Browse files
committed
Merge branch 'xa_alloc_cyclic-checks'
Michal Swiatkowski says: ==================== fix xa_alloc_cyclic() return checks Pierre Riteau <[email protected]> found suspicious handling an error from xa_alloc_cyclic() in scheduler code [1]. The same is done in few other places. v1 --> v2: [2] * add fixes tags * fix also the same usage in dpll and phy [1] https://lore.kernel.org/netdev/[email protected]/ [2] https://lore.kernel.org/netdev/[email protected]/ ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 9a81fc3 + 3178d2b commit d9c743b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/dpll/dpll_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
505505
xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC);
506506
ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,
507507
&dpll_pin_xa_id, GFP_KERNEL);
508-
if (ret)
508+
if (ret < 0)
509509
goto err_xa_alloc;
510510
return pin;
511511
err_xa_alloc:

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;

net/devlink/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static struct devlink_rel *devlink_rel_alloc(void)
117117

118118
err = xa_alloc_cyclic(&devlink_rels, &rel->index, rel,
119119
xa_limit_32b, &next, GFP_KERNEL);
120-
if (err) {
120+
if (err < 0) {
121121
kfree(rel);
122122
return ERR_PTR(err);
123123
}

0 commit comments

Comments
 (0)