mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-03-20 22:15:59 +00:00
blk: fix wrong idr_pre_get() error check in loop.c
The idr_pre_get() function never returns a value < 0. It returns 0 (no memory) or 1 (OK). Reported-by: Silva Paulo <psdasilva@yahoo.com> [ Rewrote Silva's patch, but attributing it to Silva anyway - Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
1daaa5e4ff
commit
68d740d79c
1 changed files with 3 additions and 5 deletions
|
@ -1597,14 +1597,12 @@ static int loop_add(struct loop_device **l, int i)
|
||||||
struct gendisk *disk;
|
struct gendisk *disk;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
lo = kzalloc(sizeof(*lo), GFP_KERNEL);
|
|
||||||
if (!lo) {
|
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
lo = kzalloc(sizeof(*lo), GFP_KERNEL);
|
||||||
|
if (!lo)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
|
||||||
|
|
||||||
err = idr_pre_get(&loop_index_idr, GFP_KERNEL);
|
if (!idr_pre_get(&loop_index_idr, GFP_KERNEL))
|
||||||
if (err < 0)
|
|
||||||
goto out_free_dev;
|
goto out_free_dev;
|
||||||
|
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue