Skip to contentSkip to conversation

ieee802154: fix at86rf212_set_txpower() exit path

PATCH Applied Jean Sacren 2 participants 2 messages Mar 1, 2014 – Mar 3, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ieee802154: fix at86rf212_set_txpower() exit path

The commit 9b2777d6089bc ("ieee802154: add TX power control to wpan_phy") introduced the new function at86rf212_set_txpower() with the questionable check of the return of __at86rf230_write() in the exit path:

1) Both at86rf212_set_txpower() and __at86rf230_write() have the same return type.

2) Whatever __at86rf230_write() returns becomes the return value of at86rf212_set_txpower().

Thus, fix the exit path by getting rid of that check entirely.

Cc Phoebe Buckheister <[email protected]>
---
 drivers/net/ieee802154/at86rf230.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/net/ieee802154/at86rf230.c +1 -6
index dd9ef5e1c730..03e24c560b2e 100644
@@ -786,7 +786,6 @@ static int
 at86rf212_set_txpower(struct ieee802154_dev *dev, int db)
 {
 	struct at86rf230_local *lp = dev->priv;
-	int rc;
 
 	/* typical maximum output is 5dBm with RG_PHY_TX_PWR 0x60, lower five
 	 * bits decrease power in 1dB steps. 0x60 represents extra PA gain of
@@ -799,11 +798,7 @@ at86rf212_set_txpower(struct ieee802154_dev *dev, int db)
 
 	db = -(db - 5);
 
-	rc = __at86rf230_write(lp, RG_PHY_TX_PWR, 0x60 | db);
-	if (rc)
-		return rc;
-
-	return 0;
+	return __at86rf230_write(lp, RG_PHY_TX_PWR, 0x60 | db);
 }
 
 static int
maintainer Applied
#1 lore raw

From: Jean Sacren <[email protected]>
Date: Sat, 1 Mar 2014 15:54:36 -0700

Quoted 8 lines

The commit 9b2777d6089bc ("ieee802154: add TX power control to wpan_phy") introduced the new function at86rf212_set_txpower() with the questionable check of the return of __at86rf230_write() in the exit path:

1) Both at86rf212_set_txpower() and __at86rf230_write() have the same return type.

Quoted 6 lines

2) Whatever __at86rf230_write() returns becomes the return value of at86rf212_set_txpower().

Thus, fix the exit path by getting rid of that check entirely.

Applied, thank you.