net: set static variable an initial value in atl2_probe()
Subsystems (4)
PATCH v3 1/1 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.
---
v1->v2: change the subject from "net: drop pointless static qualifier in atl2_probe()" to "net: set static variable an initial value in atl2_probe()";
keep 'static' for variable cards_found.
v2->v3: change patch description, and send patch to netdev mail list.
drivers/net/ethernet/atheros/atlx/atl2.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atlx/atl2.c +1 -3
@@ -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;
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Mao Wenan <[email protected]>
Date: Fri, 22 Feb 2019 14:57:23 +0800
Quoted 5 lines
cards_foundis a static variable, but when it entersatl2_probe(),cards_foundis 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]>
Applied and queued up for -stable, thanks.