diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/dma-debug.c | 2 | ||||
-rw-r--r-- | lib/idr.c | 7 |
2 files changed, 4 insertions, 5 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 7d2f0b33e5a8..ba8b67039d13 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -587,7 +587,7 @@ out_unlock: | |||
587 | return count; | 587 | return count; |
588 | } | 588 | } |
589 | 589 | ||
590 | const struct file_operations filter_fops = { | 590 | static const struct file_operations filter_fops = { |
591 | .read = filter_read, | 591 | .read = filter_read, |
592 | .write = filter_write, | 592 | .write = filter_write, |
593 | }; | 593 | }; |
@@ -140,8 +140,7 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) | |||
140 | id = *starting_id; | 140 | id = *starting_id; |
141 | restart: | 141 | restart: |
142 | p = idp->top; | 142 | p = idp->top; |
143 | l = idp->layers; | 143 | l = p->layer; |
144 | pa[l--] = NULL; | ||
145 | while (1) { | 144 | while (1) { |
146 | /* | 145 | /* |
147 | * We run around this while until we reach the leaf node... | 146 | * We run around this while until we reach the leaf node... |
@@ -155,8 +154,8 @@ static int sub_alloc(struct idr *idp, int *starting_id, struct idr_layer **pa) | |||
155 | oid = id; | 154 | oid = id; |
156 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; | 155 | id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1; |
157 | 156 | ||
158 | /* if already at the top layer, we need to grow */ | 157 | /* did id go over the limit? */ |
159 | if (!(p = pa[l])) { | 158 | if (id >= (1 << (idp->layers * IDR_BITS))) { |
160 | *starting_id = id; | 159 | *starting_id = id; |
161 | return IDR_NEED_TO_GROW; | 160 | return IDR_NEED_TO_GROW; |
162 | } | 161 | } |