Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171373
b: refs/heads/master
c: 93a59d7
h: refs/heads/master
i:
  171371: 4dc7b87
v: v3
  • Loading branch information
Christian Lamparter authored and John W. Linville committed Nov 2, 2009
1 parent bd00abc commit 466518c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d3560d4fc9c5b9fe1a07a63926ea70512c69c32
refs/heads/master: 93a59d7527147e3656664aa3179f8d19de256081
31 changes: 19 additions & 12 deletions trunk/drivers/net/wireless/p54/eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int p54_generate_band(struct ieee80211_hw *dev,
int ret = -ENOMEM;

if ((!list->entries) || (!list->band_channel_num[band]))
return 0;
return -EINVAL;

tmp = kzalloc(sizeof(*tmp), GFP_KERNEL);
if (!tmp)
Expand Down Expand Up @@ -158,14 +158,24 @@ static int p54_generate_band(struct ieee80211_hw *dev,
(list->channels[i].data & CHAN_HAS_CURVE ? "" :
" [curve data]"),
list->channels[i].index, list->channels[i].freq);
continue;
}

tmp->channels[j].band = list->channels[i].band;
tmp->channels[j].center_freq = list->channels[i].freq;
j++;
}

tmp->n_channels = list->band_channel_num[band];
if (j == 0) {
printk(KERN_ERR "%s: Disabling totally damaged %s band.\n",
wiphy_name(dev->wiphy), (band == IEEE80211_BAND_2GHZ) ?
"2 GHz" : "5 GHz");

ret = -ENODATA;
goto err_out;
}

tmp->n_channels = j;
old = priv->band_table[band];
priv->band_table[band] = tmp;
if (old) {
Expand Down Expand Up @@ -228,13 +238,13 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
struct p54_common *priv = dev->priv;
struct p54_channel_list *list;
unsigned int i, j, max_channel_num;
int ret = -ENOMEM;
int ret = 0;
u16 freq;

if ((priv->iq_autocal_len != priv->curve_data->entries) ||
(priv->iq_autocal_len != priv->output_limit->entries))
printk(KERN_ERR "%s: EEPROM is damaged... you may not be able"
"to use all channels with this device.\n",
printk(KERN_ERR "%s: Unsupported or damaged EEPROM detected. "
"You may not be able to use all channels.\n",
wiphy_name(dev->wiphy));

max_channel_num = max_t(unsigned int, priv->output_limit->entries,
Expand All @@ -243,8 +253,10 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
priv->curve_data->entries);

list = kzalloc(sizeof(*list), GFP_KERNEL);
if (!list)
if (!list) {
ret = -ENOMEM;
goto free;
}

list->max_entries = max_channel_num;
list->channels = kzalloc(sizeof(struct p54_channel_entry) *
Expand Down Expand Up @@ -282,13 +294,8 @@ static int p54_generate_channel_lists(struct ieee80211_hw *dev)
p54_compare_channels, NULL);

for (i = 0, j = 0; i < IEEE80211_NUM_BANDS; i++) {
if (list->band_channel_num[i]) {
ret = p54_generate_band(dev, list, i);
if (ret)
goto free;

if (p54_generate_band(dev, list, i) == 0)
j++;
}
}
if (j == 0) {
/* no useable band available. */
Expand Down

0 comments on commit 466518c

Please sign in to comment.