Skip to contentSkip to conversation

taging: rtl8192u: ieee80211: prefer pr_debug over printk

PATCH In review Aastha Gupta 2 participants 2 messages Sep 16, 2017 – Sep 18, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 taging: rtl8192u: ieee80211: prefer pr_debug over printk

This patch replaces call to printk with pr_debug function, thus addressing the following checkpatch script warning:

WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...

---
changes in v2:
-replaces string with function name with %s and __func__. -combines all strings concatenations into one -follows line not over 80 characters rule

 .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c      | 56 ++++++++++------------
 1 file changed, 24 insertions(+), 32 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +24 -32
index 60ecfec..6bca4af 100644
@@ -74,8 +74,7 @@ static void *ieee80211_tkip_init(int key_idx)
 	priv->tx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0,
 			CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->tx_tfm_arc4)) {
-		printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-				"crypto API arc4\n");
+		pr_debug("%s: could not allocate crypto API arc4\n", __func__);
 		priv->tx_tfm_arc4 = NULL;
 		goto fail;
 	}
@@ -83,8 +82,8 @@ static void *ieee80211_tkip_init(int key_idx)
 	priv->tx_tfm_michael = crypto_alloc_ahash("michael_mic", 0,
 			CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->tx_tfm_michael)) {
-		printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-				"crypto API michael_mic\n");
+		pr_debug("%s: could not allocate crypto API michael_mic\n",
+			 __func__);
 		priv->tx_tfm_michael = NULL;
 		goto fail;
 	}
@@ -92,8 +91,7 @@ static void *ieee80211_tkip_init(int key_idx)
 	priv->rx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0,
 			CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->rx_tfm_arc4)) {
-		printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-				"crypto API arc4\n");
+		pr_debug("%s: could not allocate crypto API arc4\n", __func__);
 		priv->rx_tfm_arc4 = NULL;
 		goto fail;
 	}
@@ -101,8 +99,8 @@ static void *ieee80211_tkip_init(int key_idx)
 	priv->rx_tfm_michael = crypto_alloc_ahash("michael_mic", 0,
 			CRYPTO_ALG_ASYNC);
 	if (IS_ERR(priv->rx_tfm_michael)) {
-		printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate "
-				"crypto API michael_mic\n");
+		pr_debug("%s: could not allocate crypto API michael_mic\n",
+			 __func__);
 		priv->rx_tfm_michael = NULL;
 		goto fail;
 	}
@@ -396,22 +394,21 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 	keyidx = pos[3];
 	if (!(keyidx & (1 << 5))) {
 		if (net_ratelimit()) {
-			printk(KERN_DEBUG "TKIP: received packet without ExtIV"
-			       " flag from %pM\n", hdr->addr2);
+			pr_debug("TKIP: received packet without ExtIV flag from %pM\n",
+				 hdr->addr2);
 		}
 		return -2;
 	}
 	keyidx >>= 6;
 	if (tkey->key_idx != keyidx) {
-		printk(KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame "
-		       "keyidx=%d priv=%p\n", tkey->key_idx, keyidx, priv);
+		pr_debug("TKIP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n",
+			 tkey->key_idx, keyidx, priv);
 		return -6;
 	}
 	if (!tkey->key_set) {
 		if (net_ratelimit()) {
-			printk(KERN_DEBUG "TKIP: received packet from %pM"
-			       " with keyid=%d that does not have a configured"
-			       " key\n", hdr->addr2, keyidx);
+			pr_debug("TKIP: received packet from %pM with keyid=%d that does not have a configured key\n",
+				 hdr->addr2, keyidx);
 		}
 		return -3;
 	}
@@ -425,10 +422,9 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 		if (iv32 < tkey->rx_iv32 ||
 		(iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) {
 			if (net_ratelimit()) {
-				printk(KERN_DEBUG "TKIP: replay detected: STA=%pM"
-				" previous TSC %08x%04x received TSC "
-				"%08x%04x\n", hdr->addr2,
-				tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);
+				pr_debug("TKIP: replay detected: STA=%pM previous TSC %08x%04x received TSC %08x%04x\n",
+					 hdr->addr2, tkey->rx_iv32,
+					 tkey->rx_iv16, iv32, iv16);
 			}
 			tkey->dot11RSNAStatsTKIPReplays++;
 			return -4;
@@ -453,9 +449,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 		skcipher_request_zero(req);
 		if (err) {
 			if (net_ratelimit()) {
-				printk(KERN_DEBUG ": TKIP: failed to decrypt "
-						"received packet from %pM\n",
-						hdr->addr2);
+				pr_debug(": TKIP: failed to decrypt received packet from %pM\n",
+					 hdr->addr2);
 			}
 			return -7;
 		}
@@ -476,8 +471,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 				tkey->rx_phase1_done = 0;
 			}
 			if (net_ratelimit()) {
-				printk(KERN_DEBUG "TKIP: ICV error detected: STA="
-				"%pM\n", hdr->addr2);
+				pr_debug("TKIP: ICV error detected: STA=%pM\n",
+					 hdr->addr2);
 			}
 			tkey->dot11RSNAStatsTKIPICVErrors++;
 			return -5;
@@ -508,7 +503,7 @@ static int michael_mic(struct crypto_ahash *tfm_michael, u8 *key, u8 *hdr,
 	int err;
 
 	if (tfm_michael == NULL) {
-		printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
+		pr_debug("%s: tfm_michael == NULL\n", __func__);
 		return -1;
 	}
 
@@ -567,9 +562,8 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri
 	hdr = (struct rtl_80211_hdr_4addr *) skb->data;
 
 	if (skb_tailroom(skb) < 8 || skb->len < hdr_len) {
-		printk(KERN_DEBUG "Invalid packet for Michael MIC add "
-		       "(tailroom=%d hdr_len=%d skb->len=%d)\n",
-		       skb_tailroom(skb), hdr_len, skb->len);
+		pr_debug("Invalid packet for Michael MIC add (tailroom=%d hdr_len=%d skb->len=%d)\n",
+			 skb_tailroom(skb), hdr_len, skb->len);
 		return -1;
 	}
 
@@ -636,10 +630,8 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,
 		struct rtl_80211_hdr_4addr *hdr;
 		hdr = (struct rtl_80211_hdr_4addr *) skb->data;
 
-		printk(KERN_DEBUG "%s: Michael MIC verification failed for "
-		       "MSDU from %pM keyidx=%d\n",
-		       skb->dev ? skb->dev->name : "N/A", hdr->addr2,
-		       keyidx);
+		pr_debug("%s: Michael MIC verification failed for MSDU from %pM keyidx=%d\n",
+			 skb->dev ? skb->dev->name : "N/A", hdr->addr2, keyidx);
 		if (skb->dev)
 			ieee80211_michael_mic_failure(skb->dev, hdr, keyidx);
 		tkey->dot11RSNAStatsTKIPLocalMICFailures++;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 6 lines · Aastha Gupta

This patch replaces call to printk with pr_debug function, thus addressing the following checkpatch script warning:

WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...

Quoted 6 lines

---
changes in v2:
-replaces string with function name with %s and __func__. -combines all strings concatenations into one -follows line not over 80 characters rule

Same issue here, also your subject is missing a 's' :)