All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: set static variable an initial value in atl2_probe()
@ 2019-02-22  5:40 Mao Wenan
  2019-02-22  6:28 ` Dan Carpenter
  2019-02-22  6:54 ` maowenan
  0 siblings, 2 replies; 3+ messages in thread
From: Mao Wenan @ 2019-02-22  5:40 UTC (permalink / raw)
  To: kernel-janitors

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.

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.  
 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] 3+ messages in thread

* Re: [PATCH v2] net: set static variable an initial value in atl2_probe()
  2019-02-22  5:40 [PATCH v2] net: set static variable an initial value in atl2_probe() Mao Wenan
@ 2019-02-22  6:28 ` Dan Carpenter
  2019-02-22  6:54 ` maowenan
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-02-22  6:28 UTC (permalink / raw)
  To: kernel-janitors

You need to send this to netdev.

On Fri, Feb 22, 2019 at 01:40:12PM +0800, Mao Wenan wrote:
> 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

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

* Re: [PATCH v2] net: set static variable an initial value in atl2_probe()
  2019-02-22  5:40 [PATCH v2] net: set static variable an initial value in atl2_probe() Mao Wenan
  2019-02-22  6:28 ` Dan Carpenter
@ 2019-02-22  6:54 ` maowenan
  1 sibling, 0 replies; 3+ messages in thread
From: maowenan @ 2019-02-22  6:54 UTC (permalink / raw)
  To: kernel-janitors



On 2019/2/22 14:28, Dan Carpenter wrote:
> You need to send this to netdev.
OK, I have done that.
> 
> On Fri, Feb 22, 2019 at 01:40:12PM +0800, Mao Wenan wrote:
>> 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.

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

end of thread, other threads:[~2019-02-22  6:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22  5:40 [PATCH v2] net: set static variable an initial value in atl2_probe() Mao Wenan
2019-02-22  6:28 ` Dan Carpenter
2019-02-22  6:54 ` maowenan

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.