scsi: sd: Remove a useless comparison
authorBart Van Assche <bart.vanassche@wdc.com>
Fri, 25 Aug 2017 20:46:35 +0000 (13:46 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 25 Aug 2017 21:08:08 +0000 (17:08 -0400)
This patch avoids that gcc reports the following warning when
building with W=1:

drivers/scsi/sd.c:315:10: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
  if (val >= 0 && val <= T10_PI_TYPE3_PROTECTION)

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c

index 8b3d7994e18268403d8323584129a92af6626dd5..7c0f9eb5a5fd68d580d26cb927416b3e2b20e440 100644 (file)
@@ -312,7 +312,7 @@ protection_type_store(struct device *dev, struct device_attribute *attr,
        if (err)
                return err;
 
-       if (val >= 0 && val <= T10_PI_TYPE3_PROTECTION)
+       if (val <= T10_PI_TYPE3_PROTECTION)
                sdkp->protection_type = val;
 
        return count;