octeon_ep: explicitly test for firmware ready value
authorShinas Rasheed <srasheed@marvell.com>
Fri, 8 Dec 2023 05:56:46 +0000 (21:56 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Dec 2023 10:00:59 +0000 (10:00 +0000)
The firmware ready value is 1, and get firmware ready status
function should explicitly test for that value. The firmware
ready value read will be 2 after driver load, and on unbind
till firmware rewrites the firmware ready back to 0, the value
seen by driver will be 2, which should be regarded as not ready.

Fixes: 10c073e40469 ("octeon_ep: defer probe if firmware not ready")
Signed-off-by: Shinas Rasheed <srasheed@marvell.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeon_ep/octep_main.c

index a2b5a3f..a9bdf32 100644 (file)
@@ -1265,7 +1265,8 @@ static bool get_fw_ready_status(struct pci_dev *pdev)
 
                pci_read_config_byte(pdev, (pos + 8), &status);
                dev_info(&pdev->dev, "Firmware ready status = %u\n", status);
-               return status;
+#define FW_STATUS_READY 1ULL
+               return status == FW_STATUS_READY;
        }
        return false;
 }