summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2023-05-18 11:49:55 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2023-05-18 11:49:55 +1000
commitcaec04b7c80dcc5b4a1074c651071bddda3befb4 (patch)
tree534d8ae4978b4b56521605dd71df7d8f62444338
parente5c7b38d88e3a9f41479bae0b2fb941bdd7da50f (diff)
parent69cb69ea55420388b444ee30b1530ec15ab584f7 (diff)
downloadlinux-next-caec04b7c80dcc5b4a1074c651071bddda3befb4.tar.gz
Merge branch 'main' of git://git.infradead.org/users/willy/xarray.git
-rw-r--r--lib/idr.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/idr.c b/lib/idr.c
index 7ecdfdb5309e..aacb3e6d895d 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -491,25 +491,22 @@ void ida_free(struct ida *ida, unsigned int id)
struct ida_bitmap *bitmap;
unsigned long flags;
- if ((int)id < 0)
- return;
-
xas_lock_irqsave(&xas, flags);
bitmap = xas_load(&xas);
if (xa_is_value(bitmap)) {
unsigned long v = xa_to_value(bitmap);
if (bit >= BITS_PER_XA_VALUE)
- goto err;
+ goto not_found;
if (!(v & (1UL << bit)))
- goto err;
+ goto not_found;
v &= ~(1UL << bit);
if (!v)
goto delete;
xas_store(&xas, xa_mk_value(v));
} else {
if (!test_bit(bit, bitmap->bitmap))
- goto err;
+ goto not_found;
__clear_bit(bit, bitmap->bitmap);
xas_set_mark(&xas, XA_FREE_MARK);
if (bitmap_empty(bitmap->bitmap, IDA_BITMAP_BITS)) {
@@ -518,11 +515,8 @@ delete:
xas_store(&xas, NULL);
}
}
+not_found:
xas_unlock_irqrestore(&xas, flags);
- return;
- err:
- xas_unlock_irqrestore(&xas, flags);
- WARN(1, "ida_free called for id=%d which is not allocated.\n", id);
}
EXPORT_SYMBOL(ida_free);