X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2Fidr.c;h=1c4f9281f412db349d3a80e0ed51e51f6102027c;hb=711a49a07f84f914aac26a52143f6e7526571143;hp=7a785a0c2ea0fccead72653a0fd66af5111888ea;hpb=c7f8d6f6b5d121e5f7408119661ca29fc4661c10;p=linux-2.6-omap-h63xx.git diff --git a/lib/idr.c b/lib/idr.c index 7a785a0c2ea..1c4f9281f41 100644 --- a/lib/idr.c +++ b/lib/idr.c @@ -220,8 +220,14 @@ build_up: */ while ((layers < (MAX_LEVEL - 1)) && (id >= (1 << (layers*IDR_BITS)))) { layers++; - if (!p->count) + if (!p->count) { + /* special case: if the tree is currently empty, + * then we grow the tree by moving the top node + * upwards. + */ + p->layer++; continue; + } if (!(new = get_from_free_list(idp))) { /* * The allocation failed. If we built part of