return -EBUSY in this caseEither+Need check xa_is_err(old).
+ mutex_lock(&group->mutex);
+ curr = xa_cmpxchg(&group->pasid_array, pasid, NULL, domain,
GFP_KERNEL);
+ if (curr)
+ goto out_unlock;
(1) old entry is a valid pointer, or
(2) xa_is_err(curr)return xa_err(cur)
are failure cases. Hence, "curr == NULL" is the only check we need. DidBut now you always return -EBUSY for all kinds of xa errors.
I miss anything?