diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-01-11 06:12:25 -0500 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2018-01-13 00:17:35 -0500 |
commit | a24e7917e1758daf9ac0da4fac0f7b48f0b4b624 (patch) | |
tree | 989e518115db338f69a1f71bbe0e1619f90bd50d | |
parent | 88cf107325fc7e37925de1960bd34ab917924362 (diff) |
tcmu: fix error return code in tcmu_configure_device()
Fix to return error code -ENOMEM from the kzalloc() error handling
case instead of 0, as done elsewhere in this function.
Fixes: 80eb876 ("tcmu: allow max block and global max blocks to be settable")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r-- | drivers/target/target_core_user.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 1238480cd4c4..60c8a87b7a88 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -1675,8 +1675,10 @@ static int tcmu_configure_device(struct se_device *dev) | |||
1675 | 1675 | ||
1676 | udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) * | 1676 | udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) * |
1677 | sizeof(unsigned long), GFP_KERNEL); | 1677 | sizeof(unsigned long), GFP_KERNEL); |
1678 | if (!udev->data_bitmap) | 1678 | if (!udev->data_bitmap) { |
1679 | ret = -ENOMEM; | ||
1679 | goto err_bitmap_alloc; | 1680 | goto err_bitmap_alloc; |
1681 | } | ||
1680 | 1682 | ||
1681 | udev->mb_addr = vzalloc(CMDR_SIZE); | 1683 | udev->mb_addr = vzalloc(CMDR_SIZE); |
1682 | if (!udev->mb_addr) { | 1684 | if (!udev->mb_addr) { |