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 A18F619F473; Thu, 15 Aug 2024 14:26:09 +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=1723731969; cv=none; b=k881HyBjN/tXkTyZb2cUQR54NVcTvTVCuMpCLzIg3kcILfNKW0e15kRFAtLlryhXkRUp83VCQ30gpN8HKPFhrsLR4FdGqttmQNBszI6KOFIMnwgR2i2aUBSD46khh/OjC0ZpCXVF6zhasBwt4xjv4+1c/PEbnYg1HLDlKoKGNfc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723731969; c=relaxed/simple; bh=xmGx5rS0DKKECLxd358tEWjQeJwRc5BilkKS1YvfAfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oB2nCfkC9RkZBgM6fSXRYUuUNBjqUry+byigp5Aek+FhJQ/Z/Y/ZAFb0qugSLi7cvlEA9aJE+BF6UILOjwNeubngef4pWp1PjUui8U4KdcPaOe9fEs0nGMFFpqteTRewlAKNk4CZPImzsLuMRz/F2BvhRyV4Bahsfo7sXGhpv1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TSlcP9sy; 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="TSlcP9sy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB8DDC32786; Thu, 15 Aug 2024 14:26:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723731969; bh=xmGx5rS0DKKECLxd358tEWjQeJwRc5BilkKS1YvfAfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TSlcP9syBKEL0xkLKaFn60QJxFFSujDizz8Qn7cwPD2XFhXWfw1Yx6OAcpADiAYZF 9Oj1uScpOFx6K7Wj+P59SpoG1go0U6/t51JdZrikppU02aOIfcAZnpHGTVlc3snTfJ MYEIY4P/Myna2RuACV6mX27b0wcHf54MnbHFo0mE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Andy Shevchenko , Arnd Bergmann , Sasha Levin Subject: [PATCH 5.10 033/352] firmware: turris-mox-rwtm: Fix checking return value of wait_for_completion_timeout() Date: Thu, 15 Aug 2024 15:21:39 +0200 Message-ID: <20240815131920.508319144@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240815131919.196120297@linuxfoundation.org> References: <20240815131919.196120297@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Behún [ Upstream commit 8467cfe821ac3526f7598682ad5f90689fa8cc49 ] The wait_for_completion_timeout() function returns 0 if timed out, and a positive value if completed. Fix the usage of this function. Fixes: 389711b37493 ("firmware: Add Turris Mox rWTM firmware driver") Fixes: 2eab59cf0d20 ("firmware: turris-mox-rwtm: fail probing when firmware does not support hwrng") Signed-off-by: Marek Behún Reviewed-by: Ilpo Järvinen Reviewed-by: Andy Shevchenko Signed-off-by: Arnd Bergmann Signed-off-by: Sasha Levin --- drivers/firmware/turris-mox-rwtm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/firmware/turris-mox-rwtm.c b/drivers/firmware/turris-mox-rwtm.c index 0bef988580ada..32c94c306b23e 100644 --- a/drivers/firmware/turris-mox-rwtm.c +++ b/drivers/firmware/turris-mox-rwtm.c @@ -199,9 +199,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) if (ret < 0) return ret; - ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2)) + return -ETIMEDOUT; ret = mox_get_status(MBOX_CMD_BOARD_INFO, reply->retval); if (ret == -ENODATA) { @@ -235,9 +234,8 @@ static int mox_get_board_info(struct mox_rwtm *rwtm) if (ret < 0) return ret; - ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2)) + return -ETIMEDOUT; ret = mox_get_status(MBOX_CMD_ECDSA_PUB_KEY, reply->retval); if (ret == -ENODATA) { @@ -274,9 +272,8 @@ static int check_get_random_support(struct mox_rwtm *rwtm) if (ret < 0) return ret; - ret = wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2); - if (ret < 0) - return ret; + if (!wait_for_completion_timeout(&rwtm->cmd_done, HZ / 2)) + return -ETIMEDOUT; return mox_get_status(MBOX_CMD_GET_RANDOM, rwtm->reply.retval); } -- 2.43.0