Skip to contentSkip to conversation

ath9k: fix an IS_ERR() vs NULL check

PATCH In review Dan Carpenter 2 participants 2 messages Oct 11, 2021 – Oct 13, 2021

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

PATCH 1/1 ath9k: fix an IS_ERR() vs NULL check

The devm_kmemdup() function doesn't return error pointers, it returns NULL on error.

Fixes eb3a97a69be8 ("ath9k: fetch calibration data via nvmem subsystem")
---
 drivers/net/wireless/ath/ath9k/init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath9k/init.c +2 -2
index 1568730fc01e..335e10133926 100644
@@ -610,8 +610,8 @@ static int ath9k_nvmem_request_eeprom(struct ath_softc *sc)
 	/* devres manages the calibration values release on shutdown */
 	ah->nvmem_blob = (u16 *)devm_kmemdup(sc->dev, buf, len, GFP_KERNEL);
 	kfree(buf);
-	if (IS_ERR(ah->nvmem_blob))
-		return PTR_ERR(ah->nvmem_blob);
+	if (!ah->nvmem_blob)
+		return -ENOMEM;
 
 	ah->nvmem_blob_len = len;
 	ah->ah_flags &= ~AH_USE_EEPROM;
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Dan Carpenter

The devm_kmemdup() function doesn't return error pointers, it returns NULL on error.

Fixes eb3a97a69be8 ("ath9k: fetch calibration data via nvmem subsystem")

Patch applied to ath-next branch of ath.git, thanks.

57671351379b ath9k: fix an IS_ERR() vs NULL check

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/20211011123533.GA15188@kili/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches