linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2] mwifiex: remove unneeded NULL check
@ 2011-09-21  7:13 Dan Carpenter
  2011-09-21 18:05 ` Bing Zhao
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-09-21  7:13 UTC (permalink / raw)
  To: Bing Zhao; +Cc: John W. Linville, linux-wireless, kernel-janitors

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 215c65a..1df5ef6 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [patch 2/2] mwifiex: remove unneeded NULL check
  2011-09-21  7:13 [patch 2/2] mwifiex: remove unneeded NULL check Dan Carpenter
@ 2011-09-21 18:05 ` Bing Zhao
  0 siblings, 0 replies; 2+ messages in thread
From: Bing Zhao @ 2011-09-21 18:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: John W. Linville, linux-wireless@vger.kernel.org,
	kernel-janitors@vger.kernel.org

Hi Dan,

Thanks for the patch.

> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Wednesday, September 21, 2011 12:14 AM
> To: Bing Zhao
> Cc: John W. Linville; linux-wireless@vger.kernel.org; kernel-janitors@vger.kernel.org
> Subject: [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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Bing Zhao <bzhao@marvell.com>

Thanks,
Bing

> 
> diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
> index 215c65a..1df5ef6 100644
> --- a/drivers/net/wireless/mwifiex/sta_ioctl.c
> +++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
> @@ -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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-21 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-21  7:13 [patch 2/2] mwifiex: remove unneeded NULL check Dan Carpenter
2011-09-21 18:05 ` Bing Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).