Skip to contentSkip to conversation

ath9k: cleanup: remove unneeded null check

PATCH New Dan Carpenter 2 participants 2 messages May 22, 2010 – May 24, 2010

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

PATCH 1/1 ath9k: cleanup: remove unneeded null check

We dereference "wmi" on the line before and also when we initialize "ah". This check has always been after a dereference since the first commit a couple months ago. Looking through the code, it looks like "wmi" can't actually be null here so I just removed the check.

drivers/net/wireless/ath/ath9k/wmi.c +0 -3
index e23172c..6260faa 100644
@@ -279,9 +279,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
 	if (wmi->drv_priv->op_flags & OP_UNPLUGGED)
 		return 0;
 
-	if (!wmi)
-		return -EINVAL;
-
 	skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);
 	if (!skb)
 		return -ENOMEM;
#1 lore raw

PATCH 1/1 ath9k: cleanup: remove unneeded null check

Quoted 6 lines · Dan Carpenter

We dereference "wmi" on the line before and also when we initialize "ah". This check has always been after a dereference since the first commit a couple months ago. Looking through the code, it looks like "wmi" can't actually be null here so I just removed the check.

Thanks.

Quoted 14 lines
drivers/net/wireless/ath/ath9k/wmi.c +0 -3
index e23172c..6260faa 100644
@@ -279,9 +279,6 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
 	if (wmi->drv_priv->op_flags & OP_UNPLUGGED)
 		return 0;
 
-	if (!wmi)
-		return -EINVAL;
-
 	skb = alloc_skb(headroom + cmd_len, GFP_ATOMIC);
 	if (!skb)
 		return -ENOMEM;