Skip to content

Commit fc1fe42

Browse files
committed
Fix an error status handling issue of MRPC
If an error is encountered when executing the MRPC command, firmware will set status register to SWITCHTEC_MRPC_STATUS_ERROR and return the specific error code in return value register. Fix driver to align with this behavior.
1 parent dbd4558 commit fc1fe42

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

switchtec.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ static void mrpc_complete_cmd(struct switchtec_dev *stdev)
208208
stuser_set_state(stuser, MRPC_DONE);
209209
stuser->return_code = 0;
210210

211-
if (stuser->status != SWITCHTEC_MRPC_STATUS_DONE)
211+
if (stuser->status != SWITCHTEC_MRPC_STATUS_DONE &&
212+
stuser->status != SWITCHTEC_MRPC_STATUS_ERROR)
212213
goto out;
213214

214215
if (stdev->dma_mrpc)
@@ -568,7 +569,8 @@ static ssize_t switchtec_dev_read(struct file *filp, char __user *data,
568569
out:
569570
mutex_unlock(&stdev->mrpc_mutex);
570571

571-
if (stuser->status == SWITCHTEC_MRPC_STATUS_DONE)
572+
if (stuser->status == SWITCHTEC_MRPC_STATUS_DONE ||
573+
stuser->status == SWITCHTEC_MRPC_STATUS_ERROR)
572574
return size;
573575
else if (stuser->status == SWITCHTEC_MRPC_STATUS_INTERRUPTED)
574576
return -ENXIO;

0 commit comments

Comments
 (0)