tcmu: fix error return code in tcmu_configure_device()
"Linux Kernel Mailing List" <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.head |
|---|---|
| Message-ID | <[email protected]> |
Web: https://git.kernel.org/torvalds/c/a24e7917e1758daf9ac0da4fac0f7b48f0b4b624 Commit: a24e7917e1758daf9ac0da4fac0f7b48f0b4b624 Parent: 88cf107325fc7e37925de1960bd34ab917924362 Refname: refs/heads/master Author: Wei Yongjun <[email protected]> AuthorDate: Thu Jan 11 11:12:25 2018 +0000 Committer: Nicholas Bellinger <[email protected]> CommitDate: Fri Jan 12 21:17:35 2018 -0800 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 <[email protected]> Acked-by: Mike Christie <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]> --- drivers/target/target_core_user.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) 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) { -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html