Skip to content

Commit

Permalink
tcm_vhost: Fix incorrect IS_ERR() usage in vhost_scsi_map_iov_to_sgl
Browse files Browse the repository at this point in the history
Fix up a new coccinelle warnings reported by Fengguang Wu + Intel
0-DAY kernel build testing backend:

drivers/vhost/tcm_vhost.c:537:23-29: ERROR: allocation function on line
533 returns NULL not ERR_PTR on failure

vim +537 drivers/vhost/tcm_vhost.c
   534          if (!sg)
   535                  return -ENOMEM;
   536          pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
 > 537                 sg, sgl_count, IS_ERR(sg));
   538          sg_init_table(sg, sgl_count);
   539
   540          tv_cmd->tvc_sgl = sg;

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
  • Loading branch information
Fengguang Wu authored and Nicholas Bellinger committed Aug 17, 2012
1 parent d987569 commit f0e0e9b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/vhost/tcm_vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,8 @@ static int vhost_scsi_map_iov_to_sgl(struct tcm_vhost_cmd *tv_cmd,
sg = kmalloc(sizeof(tv_cmd->tvc_sgl[0]) * sgl_count, GFP_ATOMIC);
if (!sg)
return -ENOMEM;
pr_debug("%s sg %p sgl_count %u is_err %ld\n", __func__,
sg, sgl_count, IS_ERR(sg));
pr_debug("%s sg %p sgl_count %u is_err %d\n", __func__,
sg, sgl_count, !sg);
sg_init_table(sg, sgl_count);

tv_cmd->tvc_sgl = sg;
Expand Down

0 comments on commit f0e0e9b

Please sign in to comment.