liquidio: Fix wrong return value in cn23xx_get_pf_num()
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Sun, 2 Aug 2020 11:15:44 +0000 (19:15 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Aug 2020 22:57:31 +0000 (15:57 -0700)
On an error exit path, a negative error code should be returned
instead of a positive return value.

Fixes: 0c45d7fe12c7e ("liquidio: fix use of pf in pass-through mode in a virtual machine")
Cc: Rick Farrington <ricardo.farrington@cavium.com>
Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/cn23xx_pf_device.c

index 43d11c38b38a9a37f617ac65387744753b5ad285..4cddd628d41b24470a2c82a0ea310ef9d7ded2b2 100644 (file)
@@ -1167,7 +1167,7 @@ static int cn23xx_get_pf_num(struct octeon_device *oct)
                oct->pf_num = ((fdl_bit >> CN23XX_PCIE_SRIOV_FDL_BIT_POS) &
                               CN23XX_PCIE_SRIOV_FDL_MASK);
        } else {
-               ret = EINVAL;
+               ret = -EINVAL;
 
                /* Under some virtual environments, extended PCI regs are
                 * inaccessible, in which case the above read will have failed.