Re: [PATCH net-next v4 11/13] net: renesas: rswitch: add passing of rswitch_private into notifiers
From: Jakub Kicinski
Date: Tue May 12 2026 - 21:37:32 EST
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
---
net: renesas: rswitch: add passing of rswitch_private into notifiers
This commit updates the notifier registration functions to accept a pointer
to the rswitch_private structure, allowing the handlers to access the
hardware.
> diff --git a/drivers/net/ethernet/renesas/rswitch_main.c b/drivers/net/ethernet/renesas/rswitch_main.c
> --- a/drivers/net/ethernet/renesas/rswitch_main.c
> +++ b/drivers/net/ethernet/renesas/rswitch_main.c
[ ... ]
> @@ -2290,7 +2290,7 @@ static int renesas_eth_sw_probe(struct platform_device *pdev)
> if (list_empty(&priv->port_list))
> dev_warn(&pdev->dev, "could not initialize any ports\n");
>
> - ret = rswitch_register_notifiers();
> + ret = rswitch_register_notifiers(priv);
> if (ret) {
> dev_err(&pdev->dev, "could not register notifiers\n");
> return ret;
If rswitch_register_notifiers() fails here, does this error path skip
cleaning up the initialization performed earlier by rswitch_init()?
It looks like rswitch_init() registers network devices, but this error path
returns directly without calling rswitch_deinit() or the runtime PM puts.
Since priv is allocated using devm_kzalloc, the memory will be automatically
freed when the probe fails. Could this result in a use-after-free if those
dangling network interfaces are subsequently brought up or receive packets?