Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+23 -18
+23 -18
drivers/net/ethernet/broadcom/asp2/bcmasp.c
··· 1152 1152 } 1153 1153 } 1154 1154 1155 - static void bcmasp_wol_irq_destroy(struct bcmasp_priv *priv) 1156 - { 1157 - if (priv->wol_irq > 0) 1158 - free_irq(priv->wol_irq, priv); 1159 - } 1160 - 1161 1155 static void bcmasp_eee_fixup(struct bcmasp_intf *intf, bool en) 1162 1156 { 1163 1157 u32 reg, phy_lpi_overwrite; ··· 1249 1255 if (priv->irq <= 0) 1250 1256 return -EINVAL; 1251 1257 1252 - priv->clk = devm_clk_get_optional_enabled(dev, "sw_asp"); 1258 + priv->clk = devm_clk_get_optional(dev, "sw_asp"); 1253 1259 if (IS_ERR(priv->clk)) 1254 1260 return dev_err_probe(dev, PTR_ERR(priv->clk), 1255 1261 "failed to request clock\n"); ··· 1277 1283 1278 1284 bcmasp_set_pdata(priv, pdata); 1279 1285 1286 + ret = clk_prepare_enable(priv->clk); 1287 + if (ret) 1288 + return dev_err_probe(dev, ret, "failed to start clock\n"); 1289 + 1280 1290 /* Enable all clocks to ensure successful probing */ 1281 1291 bcmasp_core_clock_set(priv, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE, 0); 1282 1292 ··· 1292 1294 1293 1295 ret = devm_request_irq(&pdev->dev, priv->irq, bcmasp_isr, 0, 1294 1296 pdev->name, priv); 1295 - if (ret) 1296 - return dev_err_probe(dev, ret, "failed to request ASP interrupt: %d", ret); 1297 + if (ret) { 1298 + dev_err(dev, "Failed to request ASP interrupt: %d", ret); 1299 + goto err_clock_disable; 1300 + } 1297 1301 1298 1302 /* Register mdio child nodes */ 1299 1303 of_platform_populate(dev->of_node, bcmasp_mdio_of_match, NULL, dev); ··· 1307 1307 1308 1308 priv->mda_filters = devm_kcalloc(dev, priv->num_mda_filters, 1309 1309 sizeof(*priv->mda_filters), GFP_KERNEL); 1310 - if (!priv->mda_filters) 1311 - return -ENOMEM; 1310 + if (!priv->mda_filters) { 1311 + ret = -ENOMEM; 1312 + goto err_clock_disable; 1313 + } 1312 1314 1313 1315 priv->net_filters = devm_kcalloc(dev, priv->num_net_filters, 1314 1316 sizeof(*priv->net_filters), GFP_KERNEL); 1315 - if (!priv->net_filters) 1316 - return -ENOMEM; 1317 + if (!priv->net_filters) { 1318 + ret = -ENOMEM; 1319 + goto err_clock_disable; 1320 + } 1317 1321 1318 1322 bcmasp_core_init_filters(priv); 1319 1323 ··· 1326 1322 ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports"); 1327 1323 if (!ports_node) { 1328 1324 dev_warn(dev, "No ports found\n"); 1329 - return -EINVAL; 1325 + ret = -EINVAL; 1326 + goto err_clock_disable; 1330 1327 } 1331 1328 1332 1329 i = 0; ··· 1349 1344 */ 1350 1345 bcmasp_core_clock_set(priv, 0, ASP_CTRL_CLOCK_CTRL_ASP_ALL_DISABLE); 1351 1346 1352 - clk_disable_unprepare(priv->clk); 1353 - 1354 1347 /* Now do the registration of the network ports which will take care 1355 1348 * of managing the clock properly. 1356 1349 */ ··· 1361 1358 count++; 1362 1359 } 1363 1360 1361 + clk_disable_unprepare(priv->clk); 1362 + 1364 1363 dev_info(dev, "Initialized %d port(s)\n", count); 1365 1364 1366 1365 return ret; 1367 1366 1368 1367 err_cleanup: 1369 - bcmasp_wol_irq_destroy(priv); 1370 1368 bcmasp_remove_intfs(priv); 1369 + err_clock_disable: 1370 + clk_disable_unprepare(priv->clk); 1371 1371 1372 1372 return ret; 1373 1373 } ··· 1382 1376 if (!priv) 1383 1377 return; 1384 1378 1385 - bcmasp_wol_irq_destroy(priv); 1386 1379 bcmasp_remove_intfs(priv); 1387 1380 } 1388 1381