Skip to contentSkip to conversation

mac802154: fix ieee802154_register_hw error handling

PATCH Superseded Alexander Aring 2 participants 2 messages Apr 13, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/1 mac802154: fix ieee802154_register_hw error handling

Currently if ieee802154_if_add failed, we don't unregister the wpan phy which was registrated before. This patch adds a correct error handling for unregister the wpan phy when ieee802154_if_add failed.

---
 net/mac802154/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac802154/main.c +3 -1
index 8500378..beece7b 100644
@@ -166,13 +166,15 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
 	if (IS_ERR(dev)) {
 		rtnl_unlock();
 		rc = PTR_ERR(dev);
-		goto out_wq;
+		goto out_phy;
 	}
 
 	rtnl_unlock();
 
 	return 0;
 
+out_phy:
+	wpan_phy_unregister(local->phy);
 out_wq:
 	destroy_workqueue(local->workqueue);
 out:
Signature · 1 line
2.3.5
#1 lore raw
Quoted 2 lines · Alexander Aring

Currently if ieee802154_if_add failed, we don't unregister the wpan phy which was registrated before. This patch adds a correct error handling

s/registrated/registered

Quoted 18 lines

for unregister the wpan phy when ieee802154_if_add failed.

---
 net/mac802154/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac802154/main.c +1 -1
index 8500378..beece7b 100644
@@ -166,13 +166,15 @@ int ieee802154_register_hw(struct ieee802154_hw *hw)
 	if (IS_ERR(dev)) {
 		rtnl_unlock();
 		rc = PTR_ERR(dev);
-		goto out_wq;
+		goto out_phy;
 	}

net/mac802154/main.c int ieee802154_register_hw(struct ieee802154_hw *hw) · line 180

Quoted 10 lines
net/mac802154/main.c +2 -0
 
 	rtnl_unlock();
 
 	return 0;
 
+out_phy:
+	wpan_phy_unregister(local->phy);
 out_wq:
 	destroy_workqueue(local->workqueue);
 out:

--
Thanks,
Varka Bhadram.