Search Linux Wireless

Re: [PATCH 2/3] ath5k: Convert chip specific calibration data to a generic format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/3/10 Jiri Slaby <jirislaby@xxxxxxxxx>:
> On 10.3.2009 11:33, Nick Kossifidis wrote:
>>
>> --- a/drivers/net/wireless/ath5k/eeprom.c
>> +++ b/drivers/net/wireless/ath5k/eeprom.c
>
> ...
>>
>> +static int
>> +ath5k_eeprom_convert_pcal_info_5111(struct ath5k_hw *ah, int mode,
>> +                               struct ath5k_chan_pcal_info *chinfo)
>> +{
>> +       struct ath5k_eeprom_info *ee =&ah->ah_capabilities.cap_eeprom;
>> +       struct ath5k_chan_pcal_info_rf5111 *pcinfo;
>> +       struct ath5k_pdgain_info *pd;
>> +       u8 pier, point, idx;
>> +       u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
>> +
>> +       /* Fill raw data for each calibration pier */
>> +       for (pier = 0; pier<  ee->ee_n_piers[mode]; pier++) {
>> +
>> +               pcinfo =&chinfo[pier].rf5111_info;
>> +
>> +               /* Allocate pd_curves for this cal pier */
>> +               chinfo[pier].pd_curves =
>> +                       kzalloc(sizeof(struct ath5k_pdgain_info) *
>> +                               AR5K_EEPROM_N_PD_CURVES, GFP_KERNEL);
>
> ...
>>
>> +               /* Allocate pd points for this curve */
>> +               pd->pd_step = kzalloc(sizeof(u8) *
>> +                                       AR5K_EEPROM_N_PWR_POINTS_5111,
>> +                                       GFP_KERNEL);
>> +               if (!pd->pd_step)
>> +                       return -ENOMEM;
>> +
>> +               pd->pd_pwr = kzalloc(sizeof(s16) *
>> +                                       AR5K_EEPROM_N_PWR_POINTS_5111,
>> +                                       GFP_KERNEL);
>
> Just a nit, these 3 may be kcalloc. (and in other places too)
>

Cool, i didn't knew about kcalloc, we can use it on rf registers too ;-)

>>  static int
>>  ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
>>  {
>>        struct ath5k_eeprom_info *ee =&ah->ah_capabilities.cap_eeprom;
>>        struct ath5k_chan_pcal_info_rf5112 *chan_pcal_info;
>>        struct ath5k_chan_pcal_info *gen_chan_info;
>> +       u8 *pdgain_idx = ee->ee_pdc_to_idx[mode];
>>        u32 offset;
>> -       unsigned int i, c;
>> +       u8 i, c;
>>        u16 val;
>>        int ret;
>> +       u8 pd_gains = 0;
>> +
>> +       /* Count how many curves we have and
>> +        * identify them (which one of the 4
>> +        * available curves we have on each count).
>> +        * Curves are stored from lower (x0) to
>> +        * higher (x3) gain */
>> +       memset(pdgain_idx, 0, sizeof(pdgain_idx));
>
> Note, that sizeof(pdgain_idx) == 4 or 8 (pointer size) depending on arch,
> this is likely not what you want :).
>
> (and the other memsets too)

Yup it's totally wrong plus i don't think we need to memset this
anyway, it should be zeroed...

Thanks a lot for the comments, i'll wait a couple of days in case
anything else comes up and i'll re-submit ;-)

-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux