mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 08:33:17 +02:00
Merge branch 'net-bcmasp-fix-issues-during-driver-unbind'
Justin Chen says: ==================== net: bcmasp: Fix issues during driver unbind Fix two issues when we unbind the driver. We hit a double free of the WoL irq and a double disable of the clk. ==================== Link: https://patch.msgid.link/20260319234813.1937315-1-justin.chen@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
bc0151c59e
|
|
@ -1152,12 +1152,6 @@ void bcmasp_enable_wol(struct bcmasp_intf *intf, bool en)
|
|||
}
|
||||
}
|
||||
|
||||
static void bcmasp_wol_irq_destroy(struct bcmasp_priv *priv)
|
||||
{
|
||||
if (priv->wol_irq > 0)
|
||||
free_irq(priv->wol_irq, priv);
|
||||
}
|
||||
|
||||
static void bcmasp_eee_fixup(struct bcmasp_intf *intf, bool en)
|
||||
{
|
||||
u32 reg, phy_lpi_overwrite;
|
||||
|
|
@ -1255,7 +1249,7 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
if (priv->irq <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
priv->clk = devm_clk_get_optional_enabled(dev, "sw_asp");
|
||||
priv->clk = devm_clk_get_optional(dev, "sw_asp");
|
||||
if (IS_ERR(priv->clk))
|
||||
return dev_err_probe(dev, PTR_ERR(priv->clk),
|
||||
"failed to request clock\n");
|
||||
|
|
@ -1283,6 +1277,10 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
|
||||
bcmasp_set_pdata(priv, pdata);
|
||||
|
||||
ret = clk_prepare_enable(priv->clk);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to start clock\n");
|
||||
|
||||
/* Enable all clocks to ensure successful probing */
|
||||
bcmasp_core_clock_set(priv, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE, 0);
|
||||
|
||||
|
|
@ -1294,8 +1292,10 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
|
||||
ret = devm_request_irq(&pdev->dev, priv->irq, bcmasp_isr, 0,
|
||||
pdev->name, priv);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "failed to request ASP interrupt: %d", ret);
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to request ASP interrupt: %d", ret);
|
||||
goto err_clock_disable;
|
||||
}
|
||||
|
||||
/* Register mdio child nodes */
|
||||
of_platform_populate(dev->of_node, bcmasp_mdio_of_match, NULL, dev);
|
||||
|
|
@ -1307,13 +1307,17 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
|
||||
priv->mda_filters = devm_kcalloc(dev, priv->num_mda_filters,
|
||||
sizeof(*priv->mda_filters), GFP_KERNEL);
|
||||
if (!priv->mda_filters)
|
||||
return -ENOMEM;
|
||||
if (!priv->mda_filters) {
|
||||
ret = -ENOMEM;
|
||||
goto err_clock_disable;
|
||||
}
|
||||
|
||||
priv->net_filters = devm_kcalloc(dev, priv->num_net_filters,
|
||||
sizeof(*priv->net_filters), GFP_KERNEL);
|
||||
if (!priv->net_filters)
|
||||
return -ENOMEM;
|
||||
if (!priv->net_filters) {
|
||||
ret = -ENOMEM;
|
||||
goto err_clock_disable;
|
||||
}
|
||||
|
||||
bcmasp_core_init_filters(priv);
|
||||
|
||||
|
|
@ -1322,7 +1326,8 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports");
|
||||
if (!ports_node) {
|
||||
dev_warn(dev, "No ports found\n");
|
||||
return -EINVAL;
|
||||
ret = -EINVAL;
|
||||
goto err_clock_disable;
|
||||
}
|
||||
|
||||
i = 0;
|
||||
|
|
@ -1344,8 +1349,6 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
*/
|
||||
bcmasp_core_clock_set(priv, 0, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE);
|
||||
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
/* Now do the registration of the network ports which will take care
|
||||
* of managing the clock properly.
|
||||
*/
|
||||
|
|
@ -1358,13 +1361,16 @@ static int bcmasp_probe(struct platform_device *pdev)
|
|||
count++;
|
||||
}
|
||||
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
dev_info(dev, "Initialized %d port(s)\n", count);
|
||||
|
||||
return ret;
|
||||
|
||||
err_cleanup:
|
||||
bcmasp_wol_irq_destroy(priv);
|
||||
bcmasp_remove_intfs(priv);
|
||||
err_clock_disable:
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -1376,7 +1382,6 @@ static void bcmasp_remove(struct platform_device *pdev)
|
|||
if (!priv)
|
||||
return;
|
||||
|
||||
bcmasp_wol_irq_destroy(priv);
|
||||
bcmasp_remove_intfs(priv);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user