Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH net v2] ravb: Fix "failed to switch device to config mode" message during unbind
@ 2022-12-14 10:51 Biju Das
  2022-12-15 14:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 3+ messages in thread
From: Biju Das @ 2022-12-14 10:51 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Philipp Zabel
  Cc: Biju Das, Sergey Shtylyov, Geert Uytterhoeven, Hangbin Liu,
	Mitsuhiro Kimura, netdev, linux-renesas-soc, Fabrizio Castro,
	stable, Leon Romanovsky

This patch fixes the error "ravb 11c20000.ethernet eth0: failed to switch
device to config mode" during unbind.

We are doing register access after pm_runtime_put_sync().

We usually do cleanup in reverse order of init. Currently in
remove(), the "pm_runtime_put_sync" is not in reverse order.

Probe
	reset_control_deassert(rstc);
	pm_runtime_enable(&pdev->dev);
	pm_runtime_get_sync(&pdev->dev);

remove
	pm_runtime_put_sync(&pdev->dev);
	unregister_netdev(ndev);
	..
	ravb_mdio_release(priv);
	pm_runtime_disable(&pdev->dev);

Consider the call to unregister_netdev()
unregister_netdev->unregister_netdevice_queue->rollback_registered_many
that calls the below functions which access the registers after
pm_runtime_put_sync()
 1) ravb_get_stats
 2) ravb_close

Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Cc: stable@vger.kernel.org
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
---
v1->v2:
 * Added Rb tag from Leon Romanovsky
 * Fixed the fixes tag
 * Patch header updated from net-next->net as it is fixes patch.
---
 drivers/net/ethernet/renesas/ravb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 33f723a9f471..b4e0fc7f65bd 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -2903,12 +2903,12 @@ static int ravb_remove(struct platform_device *pdev)
 			  priv->desc_bat_dma);
 	/* Set reset mode */
 	ravb_write(ndev, CCC_OPC_RESET, CCC);
-	pm_runtime_put_sync(&pdev->dev);
 	unregister_netdev(ndev);
 	if (info->nc_queues)
 		netif_napi_del(&priv->napi[RAVB_NC]);
 	netif_napi_del(&priv->napi[RAVB_BE]);
 	ravb_mdio_release(priv);
+	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	reset_control_assert(priv->rstc);
 	free_netdev(ndev);
-- 
2.25.1


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

* Re: [PATCH net v2] ravb: Fix "failed to switch device to config mode" message during unbind
  2022-12-14 10:51 [PATCH net v2] ravb: Fix "failed to switch device to config mode" message during unbind Biju Das
@ 2022-12-15 14:40 ` patchwork-bot+netdevbpf
  2022-12-15 16:43   ` Sergey Shtylyov
  0 siblings, 1 reply; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-12-15 14:40 UTC (permalink / raw)
  To: Biju Das
  Cc: davem, edumazet, kuba, pabeni, p.zabel, s.shtylyov, geert+renesas,
	liuhangbin, mitsuhiro.kimura.kc, netdev, linux-renesas-soc,
	fabrizio.castro.jz, stable, leonro

Hello:

This patch was applied to netdev/net.git (master)
by Paolo Abeni <pabeni@redhat.com>:

On Wed, 14 Dec 2022 10:51:18 +0000 you wrote:
> This patch fixes the error "ravb 11c20000.ethernet eth0: failed to switch
> device to config mode" during unbind.
> 
> We are doing register access after pm_runtime_put_sync().
> 
> We usually do cleanup in reverse order of init. Currently in
> remove(), the "pm_runtime_put_sync" is not in reverse order.
> 
> [...]

Here is the summary with links:
  - [net,v2] ravb: Fix "failed to switch device to config mode" message during unbind
    https://git.kernel.org/netdev/net/c/c72a7e42592b

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net v2] ravb: Fix "failed to switch device to config mode" message during unbind
  2022-12-15 14:40 ` patchwork-bot+netdevbpf
@ 2022-12-15 16:43   ` Sergey Shtylyov
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Shtylyov @ 2022-12-15 16:43 UTC (permalink / raw)
  To: patchwork-bot+netdevbpf, Biju Das
  Cc: davem, edumazet, kuba, pabeni, p.zabel, geert+renesas, liuhangbin,
	mitsuhiro.kimura.kc, netdev, linux-renesas-soc,
	fabrizio.castro.jz, stable, leonro

On 12/15/22 5:40 PM, patchwork-bot+netdevbpf@kernel.org wrote:

> Hello:
> 
> This patch was applied to netdev/net.git (master)
> by Paolo Abeni <pabeni@redhat.com>:
> 
> On Wed, 14 Dec 2022 10:51:18 +0000 you wrote:
>> This patch fixes the error "ravb 11c20000.ethernet eth0: failed to switch
>> device to config mode" during unbind.
>>
>> We are doing register access after pm_runtime_put_sync().
>>
>> We usually do cleanup in reverse order of init. Currently in
>> remove(), the "pm_runtime_put_sync" is not in reverse order.
>>
>> [...]
> 
> Here is the summary with links:
>   - [net,v2] ravb: Fix "failed to switch device to config mode" message during unbind
>     https://git.kernel.org/netdev/net/c/c72a7e42592b
> 
> You are awesome, thank you!

   Oops, was going to review the patch tonight, now that I'm back from the hospitals.

MBR, Sergey

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

end of thread, other threads:[~2022-12-15 16:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-14 10:51 [PATCH net v2] ravb: Fix "failed to switch device to config mode" message during unbind Biju Das
2022-12-15 14:40 ` patchwork-bot+netdevbpf
2022-12-15 16:43   ` Sergey Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox