Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Gustavo A. R. Silva and committed by
Jens Axboe
0979962f 60eb34ec

+1 -1
+1 -1
drivers/block/nbd.c
··· 1591 1591 if (new_index < 0) { 1592 1592 mutex_unlock(&nbd_index_mutex); 1593 1593 printk(KERN_ERR "nbd: failed to add new device\n"); 1594 - return ret; 1594 + return new_index; 1595 1595 } 1596 1596 nbd = idr_find(&nbd_index_idr, new_index); 1597 1597 }