From patchwork Wed Nov 20 13:50:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin King X-Patchwork-Id: 11253969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BB3F413A4 for ; Wed, 20 Nov 2019 13:50:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5CEC22506 for ; Wed, 20 Nov 2019 13:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730716AbfKTNum (ORCPT ); Wed, 20 Nov 2019 08:50:42 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:42757 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727671AbfKTNum (ORCPT ); Wed, 20 Nov 2019 08:50:42 -0500 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1iXQNL-0008NI-Na; Wed, 20 Nov 2019 13:50:31 +0000 From: Colin King To: Jack Wang , "James E . J . Bottomley" , "Martin K . Petersen" , Deepak Ukey , Viswas G , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] scsi: pm80xx: fix logic to break out of loop when register value is 2 or 3 Date: Wed, 20 Nov 2019 13:50:31 +0000 Message-Id: <20191120135031.270708-1-colin.king@canonical.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Colin Ian King The condition (reg_val != 2) || (reg_val != 3) will always be true because reg_val cannot be equal to two different values at the same time. Fix this by replacing the || operator with && so that the loop will loop if reg_val is not a 2 and not a 3 as was originally intended. Addresses-Coverity: ("Constant expression result") Fixes: 50dc2f221455 ("scsi: pm80xx: Modified the logic to collect fatal dump") Signed-off-by: Colin Ian King Acked-by: Jack Wang --- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 19601138e889..d41908b23760 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -348,7 +348,7 @@ ssize_t pm80xx_get_fatal_dump(struct device *cdev, do { reg_val = pm8001_mr32(fatal_table_address, MPI_FATAL_EDUMP_TABLE_STATUS); - } while (((reg_val != 2) || (reg_val != 3)) && + } while (((reg_val != 2) && (reg_val != 3)) && time_before(jiffies, start)); if (reg_val < 2) {