All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3] net: set static variable an initial value in atl2_probe()
@ 2019-02-22  6:57 ` Mao Wenan
  0 siblings, 0 replies; 4+ messages in thread
From: Mao Wenan @ 2019-02-22  6:57 UTC (permalink / raw)
  To: kernel-janitors, chris.snook, jcliburn, dan.carpenter, netdev, davem

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 <maowenan@huawei.com>
---
 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(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index bb41becb6609..31ff1e0d1baa 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;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net v3] net: set static variable an initial value in atl2_probe()
@ 2019-02-22  6:57 ` Mao Wenan
  0 siblings, 0 replies; 4+ messages in thread
From: Mao Wenan @ 2019-02-22  6:57 UTC (permalink / raw)
  To: kernel-janitors, chris.snook, jcliburn, dan.carpenter, netdev, davem

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 <maowenan@huawei.com>
---
 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(-)

diff --git a/drivers/net/ethernet/atheros/atlx/atl2.c b/drivers/net/ethernet/atheros/atlx/atl2.c
index bb41becb6609..31ff1e0d1baa 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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net v3] net: set static variable an initial value in atl2_probe()
  2019-02-22  6:57 ` Mao Wenan
@ 2019-02-23 21:47   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-23 21:47 UTC (permalink / raw)
  To: maowenan; +Cc: kernel-janitors, chris.snook, jcliburn, dan.carpenter, netdev

From: Mao Wenan <maowenan@huawei.com>
Date: Fri, 22 Feb 2019 14:57:23 +0800

> 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 <maowenan@huawei.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net v3] net: set static variable an initial value in atl2_probe()
@ 2019-02-23 21:47   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-02-23 21:47 UTC (permalink / raw)
  To: maowenan; +Cc: kernel-janitors, chris.snook, jcliburn, dan.carpenter, netdev

From: Mao Wenan <maowenan@huawei.com>
Date: Fri, 22 Feb 2019 14:57:23 +0800

> 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 <maowenan@huawei.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-23 21:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22  6:57 [PATCH net v3] net: set static variable an initial value in atl2_probe() Mao Wenan
2019-02-22  6:57 ` Mao Wenan
2019-02-23 21:47 ` David Miller
2019-02-23 21:47   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.