Search Linux Wireless

Re: [PATCH v2 1/2] bcma: return error in bcma_sprom_get() when fallback fails

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

 



On 03/06/2012 03:50 PM, Arend van Spriel wrote:
> When not SPROM is available a fallback mechanism is used. However,
> when that fails the code currently continues. This patch assures
> that the bcma_sprom_get() function aborts when that happens.
> 
> Cc: Rafal Milecki <zajec5@xxxxxxxxx>
> Cc: Hauke Mehrtens <hauke@xxxxxxxxxx>
> Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
Acked-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
> ---
>  drivers/bcma/sprom.c |   27 +++++++++++++++++----------
>  1 files changed, 17 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
> index 916ae25..fba8066 100644
> --- a/drivers/bcma/sprom.c
> +++ b/drivers/bcma/sprom.c
> @@ -49,10 +49,23 @@ int bcma_arch_register_fallback_sprom(int (*sprom_callback)(struct bcma_bus *bus
>  static int bcma_fill_sprom_with_fallback(struct bcma_bus *bus,
>  					 struct ssb_sprom *out)
>  {
> -	if (!get_fallback_sprom)
> -		return -ENOENT;
> +	int err;
>  
> -	return get_fallback_sprom(bus, out);
> +	if (!get_fallback_sprom) {
> +		err = -ENOENT;
> +		goto fail;
> +	}
> +
> +	err = get_fallback_sprom(bus, out);
> +	if (err)
> +		goto fail;
> +
> +	pr_debug("Using SPROM revision %d provided by"
> +		 " platform.\n", bus->sprom.revision);
> +	return 0;
> +fail:
> +	pr_warn("Using fallback SPROM failed (err %d)\n", err);
> +	return err;
>  }
>  
>  /**************************************************
> @@ -317,13 +330,7 @@ int bcma_sprom_get(struct bcma_bus *bus)
>  		 * available for this device in some other storage.
>  		 */
>  		err = bcma_fill_sprom_with_fallback(bus, &bus->sprom);
> -		if (err) {
> -			pr_warn("Using fallback SPROM failed (err %d)\n", err);
> -		} else {
> -			pr_debug("Using SPROM revision %d provided by"
> -				 " platform.\n", bus->sprom.revision);
> -			return 0;
> -		}
> +		return err;
>  	}
>  
>  	sprom = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),

--
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 Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux