Commit d9c743b6 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'xa_alloc_cyclic-checks'

Michal Swiatkowski says:

====================
fix xa_alloc_cyclic() return checks

Pierre Riteau <pierre@stackhpc.com> 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/20250213223610.320278-1-pierre@stackhpc.com/
[2] https://lore.kernel.org/netdev/20250214132453.4108-1-michal.swiatkowski@linux.intel.com/


====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 9a81fc34 3178d2b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
	xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC);
	ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,
			      &dpll_pin_xa_id, GFP_KERNEL);
	if (ret)
	if (ret < 0)
		goto err_xa_alloc;
	return pin;
err_xa_alloc:
+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;
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static struct devlink_rel *devlink_rel_alloc(void)

	err = xa_alloc_cyclic(&devlink_rels, &rel->index, rel,
			      xa_limit_32b, &next, GFP_KERNEL);
	if (err) {
	if (err < 0) {
		kfree(rel);
		return ERR_PTR(err);
	}