]> www.infradead.org Git - users/dwmw2/linux.git/commit
net: ethernet: ti: am65-cpsw: ensure proper channel cleanup in error path
authorRoger Quadros <rogerq@kernel.org>
Fri, 17 Jan 2025 14:06:33 +0000 (16:06 +0200)
committerJakub Kicinski <kuba@kernel.org>
Mon, 20 Jan 2025 22:57:26 +0000 (14:57 -0800)
commit681eb2beb3efe21e630bcc4881595e3b42dd7948
treede6a67b62b8d53a871750cb08b638387bc28b852
parentb115243ab8bd92387cf524ba3a7d81eda8eca885
net: ethernet: ti: am65-cpsw: ensure proper channel cleanup in error path

We are missing netif_napi_del() and am65_cpsw_nuss_free_tx/rx_chns()
in error path when am65_cpsw_nuss_init_tx/rx_chns() is used anywhere
other than at probe(). i.e. am65_cpsw_nuss_update_tx_rx_chns and
am65_cpsw_nuss_resume()

As reported, in am65_cpsw_nuss_update_tx_rx_chns(),
if am65_cpsw_nuss_init_tx_chns() partially fails then
devm_add_action(dev, am65_cpsw_nuss_free_tx_chns,..) is added
but the cleanup via am65_cpsw_nuss_free_tx_chns() will not run.

Same issue exists for am65_cpsw_nuss_init_tx/rx_chns() failures
in am65_cpsw_nuss_resume() as well.

This would otherwise require more instances of devm_add/remove_action
and is clearly more of a distraction than any benefit.

So, drop devm_add/remove_action for am65_cpsw_nuss_free_tx/rx_chns()
and call am65_cpsw_nuss_free_tx/rx_chns() and netif_napi_del()
where required.

Reported-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Closes: https://lore.kernel.org/all/m4rhkzcr7dlylxr54udyt6lal5s2q4krrvmyay6gzgzhcu4q2c@r34snfumzqxy/
Signed-off-by: Roger Quadros <rogerq@kernel.org>
Link: https://patch.msgid.link/20250117-am65-cpsw-streamline-v2-1-91a29c97e569@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ti/am65-cpsw-nuss.c