Skip to content

Commit 0ea064e

Browse files
emuslnkuba-moo
authored andcommitted
pds_core: pass opcode to devcmd_wait
Don't rely on the PCI memory for the devcmd opcode because we read a 0xff value if the PCI bus is broken, which can cause us to report a bogus dev_cmd opcode later. Fixes: 523847d ("pds_core: add devcmd device interfaces") Signed-off-by: Shannon Nelson <[email protected]> Reviewed-by: Brett Creeley <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 969cfd4 commit 0ea064e

File tree

1 file changed

+2
-5
lines changed
  • drivers/net/ethernet/amd/pds_core

1 file changed

+2
-5
lines changed

drivers/net/ethernet/amd/pds_core/dev.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static const char *pdsc_devcmd_str(int opcode)
121121
}
122122
}
123123

124-
static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
124+
static int pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
125125
{
126126
struct device *dev = pdsc->dev;
127127
unsigned long start_time;
@@ -131,9 +131,6 @@ static int pdsc_devcmd_wait(struct pdsc *pdsc, int max_seconds)
131131
int done = 0;
132132
int err = 0;
133133
int status;
134-
int opcode;
135-
136-
opcode = ioread8(&pdsc->cmd_regs->cmd.opcode);
137134

138135
start_time = jiffies;
139136
max_wait = start_time + (max_seconds * HZ);
@@ -180,7 +177,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd,
180177

181178
memcpy_toio(&pdsc->cmd_regs->cmd, cmd, sizeof(*cmd));
182179
pdsc_devcmd_dbell(pdsc);
183-
err = pdsc_devcmd_wait(pdsc, max_seconds);
180+
err = pdsc_devcmd_wait(pdsc, cmd->opcode, max_seconds);
184181
memcpy_fromio(comp, &pdsc->cmd_regs->comp, sizeof(*comp));
185182

186183
if ((err == -ENXIO || err == -ETIMEDOUT) && pdsc->wq)

0 commit comments

Comments
 (0)