Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: arcmsr: remove redundant check for secs < 0

The check for secs being less than zero is redundant for two reasons.
Firstly, secs is unsigned so the check is always going to be false.
Secondly, if secs was signed the proceeding calculation of secs is never
going to be negative. Hence we can remove this redundant check and day
and secs re-adjustment.

Detected by static analysis with smatch:
arcmsr_set_iop_datetime() warn: unsigned 'secs' is never less than zero.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Ching Huang <ching2048@areca.com.tw>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Colin Ian King and committed by
Martin K. Petersen
3c62ecda 8c5a50e8

-4
-4
drivers/scsi/arcmsr/arcmsr_hba.c
··· 3679 3679 secs = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60)); 3680 3680 days = secs / 86400; 3681 3681 secs = secs - 86400 * days; 3682 - if (secs < 0) { 3683 - days = days - 1; 3684 - secs = secs + 86400; 3685 - } 3686 3682 j = days / 146097; 3687 3683 i = days - 146097 * j; 3688 3684 a = i + 719468;