All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Cc: sgruszka@redhat.com, linville@tuxdriver.com,
	kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] iwlegacy: add missing null check
Date: Fri, 03 Jun 2011 03:07:46 +0000	[thread overview]
Message-ID: <20110603030746.GA4834@joana> (raw)
In-Reply-To: <1307066770-27309-5-git-send-email-Gregory.Dietsche@cuw.edu>

Hi Greg,

* Greg Dietsche <Gregory.Dietsche@cuw.edu> [2011-06-02 21:06:10 -0500]:

> lq_sta has other null checks in this funcion.
> assuming they are correct, this additional null check
> should be added too.
> 
> Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
> ---
>  drivers/net/wireless/iwlegacy/iwl-4965-rs.c |   66 ++++++++++++++-------------
>  1 files changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> index 24d1499..a475aac 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> @@ -2275,40 +2275,42 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
>  	if (rate_control_send_low(sta, priv_sta, txrc))
>  		return;
>  
> -	rate_idx  = lq_sta->last_txrate_idx;
> -
> -	if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
> -		rate_idx -= IWL_FIRST_OFDM_RATE;
> -		/* 6M and 9M shared same MCS index */
> -		rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
> -		if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >> -			 IWL_RATE_MIMO2_6M_PLCP)
> -			rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
> -		info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
> -			info->control.rates[0].flags |> -					IEEE80211_TX_RC_SHORT_GI;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK)
> -			info->control.rates[0].flags |> -					IEEE80211_TX_RC_DUP_DATA;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK)
> -			info->control.rates[0].flags |> -					IEEE80211_TX_RC_40_MHZ_WIDTH;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK)
> -			info->control.rates[0].flags |> -					IEEE80211_TX_RC_GREEN_FIELD;
> -	} else {
> -		/* Check for invalid rates */
> -		if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) ||
> -				((sband->band = IEEE80211_BAND_5GHZ) &&
> -				 (rate_idx < IWL_FIRST_OFDM_RATE)))
> -			rate_idx = rate_lowest_index(sband, sta);
> -		/* On valid 5 GHz rate, adjust index */
> -		else if (sband->band = IEEE80211_BAND_5GHZ)
> +	if (lq_sta) {

Then do
	if (!lq_sta)
		return;

to avoid an exatra level of indentation.

-- 
Gustavo F. Padovan
http://profusion.mobi

WARNING: multiple messages have this Message-ID (diff)
From: "Gustavo F. Padovan" <padovan@profusion.mobi>
To: Greg Dietsche <Gregory.Dietsche@cuw.edu>
Cc: sgruszka@redhat.com, linville@tuxdriver.com,
	kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] iwlegacy: add missing null check
Date: Fri, 3 Jun 2011 00:07:46 -0300	[thread overview]
Message-ID: <20110603030746.GA4834@joana> (raw)
In-Reply-To: <1307066770-27309-5-git-send-email-Gregory.Dietsche@cuw.edu>

Hi Greg,

* Greg Dietsche <Gregory.Dietsche@cuw.edu> [2011-06-02 21:06:10 -0500]:

> lq_sta has other null checks in this funcion.
> assuming they are correct, this additional null check
> should be added too.
> 
> Signed-off-by: Greg Dietsche <Gregory.Dietsche@cuw.edu>
> ---
>  drivers/net/wireless/iwlegacy/iwl-4965-rs.c |   66 ++++++++++++++-------------
>  1 files changed, 34 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> index 24d1499..a475aac 100644
> --- a/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> +++ b/drivers/net/wireless/iwlegacy/iwl-4965-rs.c
> @@ -2275,40 +2275,42 @@ iwl4965_rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
>  	if (rate_control_send_low(sta, priv_sta, txrc))
>  		return;
>  
> -	rate_idx  = lq_sta->last_txrate_idx;
> -
> -	if (lq_sta->last_rate_n_flags & RATE_MCS_HT_MSK) {
> -		rate_idx -= IWL_FIRST_OFDM_RATE;
> -		/* 6M and 9M shared same MCS index */
> -		rate_idx = (rate_idx > 0) ? (rate_idx - 1) : 0;
> -		if (iwl4965_rs_extract_rate(lq_sta->last_rate_n_flags) >=
> -			 IWL_RATE_MIMO2_6M_PLCP)
> -			rate_idx = rate_idx + MCS_INDEX_PER_STREAM;
> -		info->control.rates[0].flags = IEEE80211_TX_RC_MCS;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_SGI_MSK)
> -			info->control.rates[0].flags |=
> -					IEEE80211_TX_RC_SHORT_GI;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_DUP_MSK)
> -			info->control.rates[0].flags |=
> -					IEEE80211_TX_RC_DUP_DATA;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_HT40_MSK)
> -			info->control.rates[0].flags |=
> -					IEEE80211_TX_RC_40_MHZ_WIDTH;
> -		if (lq_sta->last_rate_n_flags & RATE_MCS_GF_MSK)
> -			info->control.rates[0].flags |=
> -					IEEE80211_TX_RC_GREEN_FIELD;
> -	} else {
> -		/* Check for invalid rates */
> -		if ((rate_idx < 0) || (rate_idx >= IWL_RATE_COUNT_LEGACY) ||
> -				((sband->band == IEEE80211_BAND_5GHZ) &&
> -				 (rate_idx < IWL_FIRST_OFDM_RATE)))
> -			rate_idx = rate_lowest_index(sband, sta);
> -		/* On valid 5 GHz rate, adjust index */
> -		else if (sband->band == IEEE80211_BAND_5GHZ)
> +	if (lq_sta) {

Then do
	if (!lq_sta)
		return;

to avoid an exatra level of indentation.

-- 
Gustavo F. Padovan
http://profusion.mobi

  reply	other threads:[~2011-06-03  3:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03  2:06 [PATCH 1/5] iwlegacy: remove unreachable code Greg Dietsche
2011-06-03  2:06 ` Greg Dietsche
2011-06-03  2:06 ` [PATCH 2/5] iwlegacy: remove unecessary if statement Greg Dietsche
2011-06-03  2:06   ` Greg Dietsche
2011-06-03  2:06 ` [PATCH 3/5] iwlegacy: return -EINVAL instead of -1 Greg Dietsche
2011-06-03  2:06   ` Greg Dietsche
2011-06-03  2:06 ` [PATCH 4/5] iwlegacy: propagate error return value Greg Dietsche
2011-06-03  2:06   ` Greg Dietsche
2011-06-03  2:06 ` [PATCH 5/5] iwlegacy: add missing null check Greg Dietsche
2011-06-03  2:06   ` Greg Dietsche
2011-06-03  3:07   ` Gustavo F. Padovan [this message]
2011-06-03  3:07     ` Gustavo F. Padovan
2011-06-03  3:24     ` [PATCH 5/5 v2] " Greg Dietsche
2011-06-03  3:24       ` Greg Dietsche
2011-06-13 14:28 ` [PATCH 1/5] iwlegacy: remove unreachable code Greg Dietsche
2011-06-13 14:28   ` Greg Dietsche
2011-06-13 14:39   ` Stanislaw Gruszka
2011-06-13 14:39     ` Stanislaw Gruszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110603030746.GA4834@joana \
    --to=padovan@profusion.mobi \
    --cc=Gregory.Dietsche@cuw.edu \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.