Search Linux Wireless

Re: [PATCH 05/15] wl12xx: 1281/1283 support - Loading FW & NVS

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

 



> diff --git a/drivers/net/wireless/wl12xx/boot.c b/drivers/net/wireless/wl12xx/boot.c
> index 69fe870..7984631 100644
> --- a/drivers/net/wireless/wl12xx/boot.c
> +++ b/drivers/net/wireless/wl12xx/boot.c
> @@ -240,36 +240,62 @@ static int wl1271_boot_upload_nvs(struct wl1271 *wl)
>  	u32 dest_addr, val;
>  	u8 *nvs_ptr, *nvs_aligned;
>  
> -	if (wl->nvs == NULL)
> -		return -ENODEV;
> +	if (wl->chip.id == CHIP_ID_1283_PG20) {
> +		struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs;
> +
> +		if (nvs == NULL)
> +			return -ENODEV;
> +
> +		if (wl->nvs_len == sizeof(struct wl128x_nvs_file)) {
> +			if (nvs->general_params.dual_mode_select)
> +				wl->enable_11a = true;
> +		} else {
> +			wl1271_error("nvs size is not as expected: %zu != %zu",
> +				     wl->nvs_len,
> +				     sizeof(struct wl128x_nvs_file));
> +			kfree(nvs);
> +			nvs = NULL;

This is wrong.  You're just setting the local nvs variable to NULL.
It's wl->nvs that should be set to NULL instead.


> +			wl->nvs_len = 0;
> +			return -EILSEQ;
> +		}
>  
> -	/*
> -	 * FIXME: the LEGACY NVS image support (NVS's missing the 5GHz band
> -	 * configurations) can be removed when those NVS files stop floating
> -	 * around.
> -	 */
> -	if (wl->nvs_len == sizeof(struct wl1271_nvs_file) ||
> -	    wl->nvs_len == WL1271_INI_LEGACY_NVS_FILE_SIZE) {
> -		/* for now 11a is unsupported in AP mode */
> -		if (wl->bss_type != BSS_TYPE_AP_BSS &&
> -		    wl->nvs->general_params.dual_mode_select)
> -			wl->enable_11a = true;
> -	}
> +		/* only the first part of the NVS needs to be uploaded */
> +		nvs_len = sizeof(nvs->nvs);
> +		nvs_ptr = (u8 *)nvs->nvs;
>  
> -	if (wl->nvs_len != sizeof(struct wl1271_nvs_file) &&
> -	    (wl->nvs_len != WL1271_INI_LEGACY_NVS_FILE_SIZE ||
> -	     wl->enable_11a)) {
> -		wl1271_error("nvs size is not as expected: %zu != %zu",
> -			     wl->nvs_len, sizeof(struct wl1271_nvs_file));
> -		kfree(wl->nvs);
> -		wl->nvs = NULL;

Same thing here.  I have fixed these.

This was causing very bad behaviour when the NVS was with the wrong
size, because we were not setting wl->nvs to NULL, but were setting
wl->nvs_len to 0.


-- 
Cheers,
Luca.

--
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