Skip to content

Commit

Permalink
[SCSI] fcoe: Remove redundant 'less than zero' check
Browse files Browse the repository at this point in the history
strtoul returns an 'unsigned long' so there is no
reason to check if the value is less than zero.

strtoul already checks for the '-' character deep
in its bowels. It will return an error if the user
has provided a negative value and fcoe_str_to_dev_loss
will return that error to its caller.

This patch fixes the following Coverity reported warning:

CID 703581 -  NO_EFFECT Unsigned compared against 0 - This
less-than-zero comparison of an unsigned value is never true. "*val < 0UL".
drivers/scsi/fcoe/fcoe_sysfs.c:105

Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Robert Love authored and James Bottomley committed Jul 20, 2012
1 parent b29a4f3 commit 902a45a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/fcoe/fcoe_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static int fcoe_str_to_dev_loss(const char *buf, unsigned long *val)
int ret;

ret = kstrtoul(buf, 0, val);
if (ret || *val < 0)
if (ret)
return -EINVAL;
/*
* Check for overflow; dev_loss_tmo is u32
Expand Down

0 comments on commit 902a45a

Please sign in to comment.