Skip to contentSkip to conversation

mwifiex: remove unneeded NULL check

PATCH In review Dan Carpenter 2 participants 2 messages Sep 21, 2011

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

PATCH 2/2 mwifiex: remove unneeded NULL check

We dereference "rate" on the lines before so the checks here are too late to help. This function is only called from mwifiex_dump_station_info() and "rate" is always a non-NULL pointer so the check can be removed.

drivers/net/wireless/mwifiex/sta_ioctl.c +2 -2
index 215c65a..1df5ef6 100644
@@ -868,10 +868,10 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
 	ret = mwifiex_rate_ioctl_cfg(priv, rate);
 
 	if (!ret) {
-		if (rate && rate->is_rate_auto)
+		if (rate->is_rate_auto)
 			rate->rate = mwifiex_index_to_data_rate(priv->tx_rate,
 							priv->tx_htinfo);
-		else if (rate)
+		else
 			rate->rate = priv->data_rate;
 	} else {
 		ret = -1;
Acked-by on v1 2/2
#1 lore raw

Hi Dan,

Thanks for the patch.

Quoted 7 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, September 21, 2011 12:14 AM
To: Bing Zhao
Cc: John W. Linville; [email protected]; [email protected]
Subject: [patch 2/2] mwifiex: remove unneeded NULL check

Quoted 6 lines

We dereference "rate" on the lines before so the checks here are too late to help. This function is only called from mwifiex_dump_station_info() and "rate" is always a non-NULL pointer so the check can be removed.

Thanks,
Bing

Quoted 18 lines
drivers/net/wireless/mwifiex/sta_ioctl.c +2 -2
index 215c65a..1df5ef6 100644
@@ -868,10 +868,10 @@ int mwifiex_drv_get_data_rate(struct mwifiex_private *priv,
 	ret = mwifiex_rate_ioctl_cfg(priv, rate);
 
 	if (!ret) {
-		if (rate && rate->is_rate_auto)
+		if (rate->is_rate_auto)
 			rate->rate = mwifiex_index_to_data_rate(priv->tx_rate,
 							priv->tx_htinfo);
-		else if (rate)
+		else
 			rate->rate = priv->data_rate;
 	} else {
 		ret = -1;