linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
@ 2022-12-01 13:47 Qiheng Lin
  2022-12-02  8:06 ` Pavan Chebbi
  2022-12-03  4:59 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Qiheng Lin @ 2022-12-01 13:47 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni
  Cc: lars.povlsen, Steen.Hegelund, daniel.machon, UNGLinuxDriver,
	netdev, linux-arm-kernel, linux-kernel, Qiheng Lin

The mchp_sparx5_probe() won't destroy workqueue created by
create_singlethread_workqueue() in sparx5_start() when later
inits failed. Add destroy_workqueue in the cleanup_ports case,
also add it in mchp_sparx5_remove()

Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
---
 drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
index eeac04b84638..b6bbb3c9bd7a 100644
--- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
+++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
@@ -887,6 +887,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
 
 cleanup_ports:
 	sparx5_cleanup_ports(sparx5);
+	if (sparx5->mact_queue)
+		destroy_workqueue(sparx5->mact_queue);
 cleanup_config:
 	kfree(configs);
 cleanup_pnode:
@@ -911,6 +913,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
 	sparx5_cleanup_ports(sparx5);
 	/* Unregister netdevs */
 	sparx5_unregister_notifier_blocks(sparx5);
+	destroy_workqueue(sparx5->mact_queue);
 
 	return 0;
 }
-- 
2.32.0


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

* Re: [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
  2022-12-01 13:47 [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue Qiheng Lin
@ 2022-12-02  8:06 ` Pavan Chebbi
  2022-12-02 10:02   ` Pavan Chebbi
  2022-12-03  4:59 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Pavan Chebbi @ 2022-12-02  8:06 UTC (permalink / raw)
  To: Qiheng Lin
  Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, netdev, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]

On Thu, Dec 1, 2022 at 6:57 PM Qiheng Lin <linqiheng@huawei.com> wrote:
>
> The mchp_sparx5_probe() won't destroy workqueue created by
> create_singlethread_workqueue() in sparx5_start() when later
> inits failed. Add destroy_workqueue in the cleanup_ports case,
> also add it in mchp_sparx5_remove()
>
> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> ---
>  drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> index eeac04b84638..b6bbb3c9bd7a 100644
> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> @@ -887,6 +887,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
>
>  cleanup_ports:
>         sparx5_cleanup_ports(sparx5);
> +       if (sparx5->mact_queue)
> +               destroy_workqueue(sparx5->mact_queue);

Would be better if you destroy inside sparx5_start() before returning failure.

>  cleanup_config:
>         kfree(configs);
>  cleanup_pnode:
> @@ -911,6 +913,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
>         sparx5_cleanup_ports(sparx5);
>         /* Unregister netdevs */
>         sparx5_unregister_notifier_blocks(sparx5);
> +       destroy_workqueue(sparx5->mact_queue);
>
>         return 0;
>  }
> --
> 2.32.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
  2022-12-02  8:06 ` Pavan Chebbi
@ 2022-12-02 10:02   ` Pavan Chebbi
  2022-12-02 10:34     ` Qiheng Lin
  0 siblings, 1 reply; 5+ messages in thread
From: Pavan Chebbi @ 2022-12-02 10:02 UTC (permalink / raw)
  To: Qiheng Lin
  Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, netdev, linux-arm-kernel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1683 bytes --]

On Fri, Dec 2, 2022 at 1:36 PM Pavan Chebbi <pavan.chebbi@broadcom.com> wrote:
>
> On Thu, Dec 1, 2022 at 6:57 PM Qiheng Lin <linqiheng@huawei.com> wrote:
> >
> > The mchp_sparx5_probe() won't destroy workqueue created by
> > create_singlethread_workqueue() in sparx5_start() when later
> > inits failed. Add destroy_workqueue in the cleanup_ports case,
> > also add it in mchp_sparx5_remove()
> >
> > Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
> > ---
> >  drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> > index eeac04b84638..b6bbb3c9bd7a 100644
> > --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> > +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
> > @@ -887,6 +887,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
> >
> >  cleanup_ports:
> >         sparx5_cleanup_ports(sparx5);
> > +       if (sparx5->mact_queue)
> > +               destroy_workqueue(sparx5->mact_queue);
>
> Would be better if you destroy inside sparx5_start() before returning failure.
>

Alternatively you could add the destroy inside sparx5_cleanup_ports()
that will cover all error exits?

> >  cleanup_config:
> >         kfree(configs);
> >  cleanup_pnode:
> > @@ -911,6 +913,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
> >         sparx5_cleanup_ports(sparx5);
> >         /* Unregister netdevs */
> >         sparx5_unregister_notifier_blocks(sparx5);
> > +       destroy_workqueue(sparx5->mact_queue);
> >
> >         return 0;
> >  }
> > --
> > 2.32.0
> >

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
  2022-12-02 10:02   ` Pavan Chebbi
@ 2022-12-02 10:34     ` Qiheng Lin
  0 siblings, 0 replies; 5+ messages in thread
From: Qiheng Lin @ 2022-12-02 10:34 UTC (permalink / raw)
  To: Pavan Chebbi
  Cc: davem, edumazet, kuba, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, netdev, linux-arm-kernel,
	linux-kernel

在 2022/12/2 18:02, Pavan Chebbi 写道:
> On Fri, Dec 2, 2022 at 1:36 PM Pavan Chebbi <pavan.chebbi@broadcom.com> wrote:
>>
>> On Thu, Dec 1, 2022 at 6:57 PM Qiheng Lin <linqiheng@huawei.com> wrote:
>>>
>>> The mchp_sparx5_probe() won't destroy workqueue created by
>>> create_singlethread_workqueue() in sparx5_start() when later
>>> inits failed. Add destroy_workqueue in the cleanup_ports case,
>>> also add it in mchp_sparx5_remove()
>>>
>>> Signed-off-by: Qiheng Lin <linqiheng@huawei.com>
>>> ---
>>>   drivers/net/ethernet/microchip/sparx5/sparx5_main.c | 3 +++
>>>   1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
>>> index eeac04b84638..b6bbb3c9bd7a 100644
>>> --- a/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
>>> +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_main.c
>>> @@ -887,6 +887,8 @@ static int mchp_sparx5_probe(struct platform_device *pdev)
>>>
>>>   cleanup_ports:
>>>          sparx5_cleanup_ports(sparx5);
>>> +       if (sparx5->mact_queue)
>>> +               destroy_workqueue(sparx5->mact_queue);
>>
>> Would be better if you destroy inside sparx5_start() before returning failure.
>>
> 
> Alternatively you could add the destroy inside sparx5_cleanup_ports()
> that will cover all error exits?

That works functionally, I have considered this modification as well. 
Since I'm not quite sure on the naming, destroying the mact_queue 
belongs to sparx5_cleanup_ports, which they don't contain now.

> 
>>>   cleanup_config:
>>>          kfree(configs);
>>>   cleanup_pnode:
>>> @@ -911,6 +913,7 @@ static int mchp_sparx5_remove(struct platform_device *pdev)
>>>          sparx5_cleanup_ports(sparx5);
>>>          /* Unregister netdevs */
>>>          sparx5_unregister_notifier_blocks(sparx5);
>>> +       destroy_workqueue(sparx5->mact_queue);
>>>
>>>          return 0;
>>>   }
>>> --
>>> 2.32.0
>>>


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

* Re: [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue
  2022-12-01 13:47 [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue Qiheng Lin
  2022-12-02  8:06 ` Pavan Chebbi
@ 2022-12-03  4:59 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-12-03  4:59 UTC (permalink / raw)
  To: Qiheng Lin
  Cc: davem, edumazet, pabeni, lars.povlsen, Steen.Hegelund,
	daniel.machon, UNGLinuxDriver, netdev, linux-arm-kernel,
	linux-kernel

On Thu, 1 Dec 2022 21:47:17 +0800 Qiheng Lin wrote:
> The mchp_sparx5_probe() won't destroy workqueue created by
> create_singlethread_workqueue() in sparx5_start() when later
> inits failed. Add destroy_workqueue in the cleanup_ports case,
> also add it in mchp_sparx5_remove()

This is a fix so it needs a Fixes tag.

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

end of thread, other threads:[~2022-12-03  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-01 13:47 [PATCH] net: microchip: sparx5: Fix missing destroy_workqueue of mact_queue Qiheng Lin
2022-12-02  8:06 ` Pavan Chebbi
2022-12-02 10:02   ` Pavan Chebbi
2022-12-02 10:34     ` Qiheng Lin
2022-12-03  4:59 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).