From: Bolarinwa Olayemi Saheed <refactormys...@gmail.com>

ioat3_dma_probe() returns PCIBIOS_ error codes from PCIe capability
accessors.

PCIBIOS_ error codes have positive values. Passing on these values is
inconsistent with functions which return only a negative value on failure.

Before passing on the return value of PCIe capability accessors, call
pcibios_err_to_errno() to convert any positive PCIBIOS_ error codes to
negative generic error values.

Suggested-by: Bjorn Helgaas <bj...@helgaas.com>
Signed-off-by: Bolarinwa Olayemi Saheed <refactormys...@gmail.com>
---
 drivers/dma/ioat/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c
index 60e9afbb896c..fc8889c2a88f 100644
--- a/drivers/dma/ioat/init.c
+++ b/drivers/dma/ioat/init.c
@@ -1195,13 +1195,13 @@ static int ioat3_dma_probe(struct ioatdma_device 
*ioat_dma, int dca)
        /* disable relaxed ordering */
        err = pcie_capability_read_word(pdev, IOAT_DEVCTRL_OFFSET, &val16);
        if (err)
-               return err;
+               return pcibios_err_to_errno(err);
 
        /* clear relaxed ordering enable */
        val16 &= ~IOAT_DEVCTRL_ROE;
        err = pcie_capability_write_word(pdev, IOAT_DEVCTRL_OFFSET, val16);
        if (err)
-               return err;
+               return pcibios_err_to_errno(err);
 
        if (ioat_dma->cap & IOAT_CAP_DPS)
                writeb(ioat_pending_level + 1,
-- 
2.18.2

Reply via email to