Skip to contentSkip to conversation

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

PATCH Superseded Mao Wenan 2 participants 3 messages Feb 22, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Mao Wenan

author
#0 lore raw

PATCH v2 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 it in the heap, 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.

 drivers/net/ethernet/atheros/atlx/atl2.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/atheros/atlx/atl2.c +1 -3
index bb41becb6609..31ff1e0d1baa 100644
@@ -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
#1 lore raw

You need to send this to netdev.

Quoted 4 lines · Mao Wenan

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

This seems reasonable. Does this do anything besides let you configure multiple cards in different ways using module parameters?

regards,
dan carpenter

author
#2 lore raw
In reply to Mao Wenan
Quoted 1 line · Dan Carpenter

You need to send this to netdev.

OK, I have done that.

Quoted 9 lines · Mao Wenan
Quoted 4 lines

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

This seems reasonable. Does this do anything besides let you configure multiple cards in different ways using module parameters?

I think this need to develop new interface by using module parameters.