Skip to content

Commit

Permalink
tcmu: fix error return code in tcmu_configure_device()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Mike Christie <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
  • Loading branch information
Wei Yongjun authored and Nicholas Bellinger committed Jan 13, 2018
1 parent 88cf107 commit a24e791
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/target/target_core_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,10 @@ static int tcmu_configure_device(struct se_device *dev)

udev->data_bitmap = kzalloc(BITS_TO_LONGS(udev->max_blocks) *
sizeof(unsigned long), GFP_KERNEL);
if (!udev->data_bitmap)
if (!udev->data_bitmap) {
ret = -ENOMEM;
goto err_bitmap_alloc;
}

udev->mb_addr = vzalloc(CMDR_SIZE);
if (!udev->mb_addr) {
Expand Down

0 comments on commit a24e791

Please sign in to comment.