From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D922515696E; Thu, 12 Dec 2024 17:39:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734025142; cv=none; b=GtE2aRHokOqO7Tbao/cHjNWOdGl+blWDYa7ipKtTRROgz2hnrPc3gStPxZDbGlk8YyWQ/lnQawP3Hyro5fCnR/50/JAnipEUbWmC+axxxFlvyqvNZtyORcZsRQuWpiha98n3MR50GFMFfUW2uUGRRBuBAF0/owygXlqAE88f3Ys= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734025142; c=relaxed/simple; bh=RYY7RP8CFF4+N5vDFjvGRlDrK6PkaYFWfBTzceeGvSc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=I2JyNB7jd5PbN8ZcKIwzFAyHKJUJEbIwy5YG2ORT1gXaji/83qZfiQg3O+S5QvI/XpXe8wgys+VuH1L25BTHtFzf/AnAFswmWN+T66feKbpPP8HQiWz5Fbds2q9eQBy/Yw02LIy5HiLHmEPq1NnKU47aOc1wTkdTxS7Lx3df83k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MR/3nsf2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="MR/3nsf2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 613BEC4CECE; Thu, 12 Dec 2024 17:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734025142; bh=RYY7RP8CFF4+N5vDFjvGRlDrK6PkaYFWfBTzceeGvSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MR/3nsf2BVl5pTeH2Wq1rykHGoj2QeX43hlufmwQolAJSe1FU1wCLFQooVRSfnVHy sW0qUVbrDxYRaewdzvJbr/KktgNw2w3661gNSrILYemeG+pm1R2N6y7W0HZSXBOQYZ Y7YSea0JOV1GzCQ23PHciLrxUSaDzZOBTTs3UOuk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "Everest K.C." , Herbert Xu , Sasha Levin Subject: [PATCH 5.4 043/321] crypto: cavium - Fix the if condition to exit loop after timeout Date: Thu, 12 Dec 2024 15:59:21 +0100 Message-ID: <20241212144231.693908549@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144229.291682835@linuxfoundation.org> References: <20241212144229.291682835@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Everest K.C [ Upstream commit 53d91ca76b6c426c546542a44c78507b42008c9e ] The while loop breaks in the first run because of incorrect if condition. It also causes the statements after the if to appear dead. Fix this by changing the condition from if(timeout--) to if(!timeout--). This bug was reported by Coverity Scan. Report: CID 1600859: (#1 of 1): Logically dead code (DEADCODE) dead_error_line: Execution cannot reach this statement: udelay(30UL); Fixes: 9e2c7d99941d ("crypto: cavium - Add Support for Octeon-tx CPT Engine") Signed-off-by: Everest K.C. Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin --- drivers/crypto/cavium/cpt/cptpf_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/cavium/cpt/cptpf_main.c b/drivers/crypto/cavium/cpt/cptpf_main.c index d9362199423f2..b3db27b142afb 100644 --- a/drivers/crypto/cavium/cpt/cptpf_main.c +++ b/drivers/crypto/cavium/cpt/cptpf_main.c @@ -45,7 +45,7 @@ static void cpt_disable_cores(struct cpt_device *cpt, u64 coremask, dev_err(dev, "Cores still busy %llx", coremask); grp = cpt_read_csr64(cpt->reg_base, CPTX_PF_EXEC_BUSY(0)); - if (timeout--) + if (!timeout--) break; udelay(CSR_DELAY); @@ -395,7 +395,7 @@ static void cpt_disable_all_cores(struct cpt_device *cpt) dev_err(dev, "Cores still busy"); grp = cpt_read_csr64(cpt->reg_base, CPTX_PF_EXEC_BUSY(0)); - if (timeout--) + if (!timeout--) break; udelay(CSR_DELAY); -- 2.43.0