Content-Type: multipart/mixed; boundary="===============2176457466342335376==" MIME-Version: 1.0 From: kelvin.cao@microchip.com To: kbuild-all@lists.01.org Subject: [PATCH 2/5] PCI/switchtec: Fix a MRPC error status handling issue Date: Fri, 24 Sep 2021 10:24:41 +0000 Message-ID: <20210924102444.4684-3-kelvin.cao@microchip.com> In-Reply-To: <20210924102444.4684-1-kelvin.cao@microchip.com> List-Id: --===============2176457466342335376== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Kelvin Cao If an error is encountered when executing a MRPC command, the firmware will set the status register to SWITCHTEC_MRPC_STATUS_ERROR and return the error code in the return value register. Add handling of SWITCHTEC_MRPC_STATUS_ERROR on status register when completing a MRPC command. Signed-off-by: Kelvin Cao --- drivers/pci/switch/switchtec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/switch/switchtec.c b/drivers/pci/switch/switchtec.c index 092653487021..76f14ed15445 100644 --- a/drivers/pci/switch/switchtec.c +++ b/drivers/pci/switch/switchtec.c @@ -230,7 +230,8 @@ static void mrpc_complete_cmd(struct switchtec_dev *std= ev) stuser_set_state(stuser, MRPC_DONE); stuser->return_code =3D 0; = - if (stuser->status !=3D SWITCHTEC_MRPC_STATUS_DONE) + if (stuser->status !=3D SWITCHTEC_MRPC_STATUS_DONE && + stuser->status !=3D SWITCHTEC_MRPC_STATUS_ERROR) goto out; = if (stdev->dma_mrpc) @@ -614,7 +615,8 @@ static ssize_t switchtec_dev_read(struct file *filp, ch= ar __user *data, out: mutex_unlock(&stdev->mrpc_mutex); = - if (stuser->status =3D=3D SWITCHTEC_MRPC_STATUS_DONE) + if (stuser->status =3D=3D SWITCHTEC_MRPC_STATUS_DONE || + stuser->status =3D=3D SWITCHTEC_MRPC_STATUS_ERROR) return size; else if (stuser->status =3D=3D SWITCHTEC_MRPC_STATUS_INTERRUPTED) return -ENXIO; -- = 2.25.1 --===============2176457466342335376==--