From patchwork Sat Dec 9 00:34:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 10103463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1830860223 for ; Sat, 9 Dec 2017 00:34:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 058A628FF2 for ; Sat, 9 Dec 2017 00:34:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED0DE28FF6; Sat, 9 Dec 2017 00:34:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7D2C28FF2 for ; Sat, 9 Dec 2017 00:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbdLIAeW (ORCPT ); Fri, 8 Dec 2017 19:34:22 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51169 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750788AbdLIAeU (ORCPT ); Fri, 8 Dec 2017 19:34:20 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eNT5q-0002Ip-HQ; Sat, 09 Dec 2017 00:34:14 +0000 From: Colin King To: "James E . J . Bottomley" , "Martin K . Petersen" , Ching Huang , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] scsi: arcmsr: remove redundant check for secs < 0 Date: Sat, 9 Dec 2017 00:34:14 +0000 Message-Id: <20171209003414.17332-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Colin Ian King 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 --- drivers/scsi/arcmsr/arcmsr_hba.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index 0707a60bf5c0..e4258b69f4be 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c @@ -3679,10 +3679,6 @@ static void arcmsr_set_iop_datetime(struct timer_list *t) secs = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60)); days = secs / 86400; secs = secs - 86400 * days; - if (secs < 0) { - days = days - 1; - secs = secs + 86400; - } j = days / 146097; i = days - 146097 * j; a = i + 719468;