Skip to contentSkip to conversation

mwifiex: remove an unneeded NULL check

PATCH In review Dan Carpenter 2 participants 2 messages Oct 18, 2011

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

PATCH 2/4 mwifiex: remove an unneeded NULL check

We dereference adapter in the error handling code so this needed to be fixed. This function is always called like:

	adapter->if_ops.host_to_card(adapter, ...);

so adapter can never be NULL and I've removed the NULL check.

drivers/net/wireless/mwifiex/pcie.c +2 -3
index 4466976..d12d440 100644
@@ -1671,9 +1671,8 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type,
 				     struct sk_buff *skb,
 				     struct mwifiex_tx_param *tx_param)
 {
-	if (!adapter || !skb) {
-		dev_err(adapter->dev, "Invalid parameter in %s <%p, %p>\n",
-				__func__, adapter, skb);
+	if (!skb) {
+		dev_err(adapter->dev, "Passed NULL skb to %s\n", __func__);
 		return -1;
 	}
 
Acked-by on v1 2/4
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Monday, October 17, 2011 11:14 PM
To: Bing Zhao
Cc: John W. Linville; [email protected]; [email protected]
Subject: [patch 2/4] mwifiex: remove an unneeded NULL check

Quoted 6 lines

We dereference adapter in the error handling code so this needed to be fixed. This function is always called like:

	adapter->if_ops.host_to_card(adapter, ...);

so adapter can never be NULL and I've removed the NULL check.

Thanks,
Bing

Quoted 17 lines
drivers/net/wireless/mwifiex/pcie.c +2 -3
index 4466976..d12d440 100644
@@ -1671,9 +1671,8 @@ static int mwifiex_pcie_host_to_card(struct mwifiex_adapter *adapter, u8 type,
 				     struct sk_buff *skb,
 				     struct mwifiex_tx_param *tx_param)
 {
-	if (!adapter || !skb) {
-		dev_err(adapter->dev, "Invalid parameter in %s <%p, %p>\n",
-				__func__, adapter, skb);
+	if (!skb) {
+		dev_err(adapter->dev, "Passed NULL skb to %s\n", __func__);
 		return -1;
 	}