summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2018-02-12 18:14:55 +0100
committerJens Axboe <axboe@kernel.dk>2018-02-27 23:51:37 +0100
commit0979962f5490abe75b3e2befb07a564fa0cf631b (patch)
tree57ae9ad76e537253eb4a530d0721ccfe40cbdd1c
parentbcache: fix kcrashes with fio in RAID5 backend dev (diff)
downloadlinux-0979962f5490abe75b3e2befb07a564fa0cf631b.tar.xz
linux-0979962f5490abe75b3e2befb07a564fa0cf631b.zip
nbd: fix return value in error handling path
It seems that the proper value to return in this particular case is the one contained into variable new_index instead of ret. Addresses-Coverity-ID: 1465148 ("Copy-paste error") Fixes: e46c7287b1c2 ("nbd: add a basic netlink interface") Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--drivers/block/nbd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5f2a4240a204..86258b00a1d4 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1591,7 +1591,7 @@ again:
if (new_index < 0) {
mutex_unlock(&nbd_index_mutex);
printk(KERN_ERR "nbd: failed to add new device\n");
- return ret;
+ return new_index;
}
nbd = idr_find(&nbd_index_idr, new_index);
}