ionic: Prevent driver/fw getting out of sync on devcmd(s)

[ Upstream commit 5466491c9e3309ed5c7adbb8fad6e93fcc9a8fe9 ]

Some stress/negative firmware testing around devcmd(s) returning
EAGAIN found that the done bit could get out of sync in the
firmware when it wasn't cleared in a retry case.

While here, change the type of the local done variable to a bool
to match the return type from ionic_dev_cmd_done().

Fixes: ec8ee71473 ("ionic: stretch heartbeat detection")
Signed-off-by: Brett Creeley <brett.creeley@amd.com>
Signed-off-by: Shannon Nelson <shannon.nelson@amd.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20250609212827.53842-1-shannon.nelson@amd.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Brett Creeley
2025-06-09 14:28:27 -07:00
committed by Greg Kroah-Hartman
parent 002aa3ed19
commit b599b31038

View File

@@ -464,9 +464,9 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
unsigned long start_time; unsigned long start_time;
unsigned long max_wait; unsigned long max_wait;
unsigned long duration; unsigned long duration;
int done = 0;
bool fw_up; bool fw_up;
int opcode; int opcode;
bool done;
int err; int err;
/* Wait for dev cmd to complete, retrying if we get EAGAIN, /* Wait for dev cmd to complete, retrying if we get EAGAIN,
@@ -474,6 +474,7 @@ static int __ionic_dev_cmd_wait(struct ionic *ionic, unsigned long max_seconds,
*/ */
max_wait = jiffies + (max_seconds * HZ); max_wait = jiffies + (max_seconds * HZ);
try_again: try_again:
done = false;
opcode = idev->opcode; opcode = idev->opcode;
start_time = jiffies; start_time = jiffies;
for (fw_up = ionic_is_fw_running(idev); for (fw_up = ionic_is_fw_running(idev);