net: set static variable an initial value in atl2_probe() [Linux 5.0]

This Linux kernel change "net: set static variable an initial value in atl2_probe()" is included in the Linux 5.0 release. This change is authored by Mao Wenan <maowenan [at]> on Fri Feb 22 14:57:23 2019 +0800. The commit for this change in Linux stable tree is 4593403 (patch).

net: set static variable an initial value in atl2_probe()

cards_found is a static variable, but when it enters atl2_probe(),
cards_found is set to zero, the value is not consistent with last probe,
so next behavior is not our expect.

Signed-off-by: Mao Wenan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/atheros/atlx/atl2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index bb41bec..31ff1e0 100644
--- a/drivers/net/ethernet/atheros/atlx/atl2.c
+++ b/drivers/net/ethernet/atheros/atlx/atl2.c
@@ -1335,13 +1335,11 @@ static int atl2_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
    struct net_device *netdev;
    struct atl2_adapter *adapter;
-   static int cards_found;
+   static int cards_found = 0;
    unsigned long mmio_start;
    int mmio_len;
    int err;

-   cards_found = 0;
    err = pci_enable_device(pdev);
    if (err)
        return err;

Leave a Reply

Your email address will not be published. Required fields are marked *