Subject: Re: [PATCH] powerpc/cpufreq: Add pr_warn() on OPAL firmware failures

From: Gautham R Shenoy <[email-masked]>
Date: Mon, 4 Aug 2014 13:40:44 +0530

On Sun, Aug 03, 2014 at 02:54:05PM +0530, Vaidyanathan Srinivasan wrote:
> @@ -131,7 +136,12 @@ static unsigned int pstate_id_to_freq(int pstate_id)
>  	int i;
> 
>  	i = powernv_pstate_info.max - pstate_id;
> -	BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0);
> +	if (i >= powernv_pstate_info.nr_pstates || i < 0) {
> +		pr_warn("PState id %d outside of PState table, "
> +			"reporting nominal id %d instead\n",
> +			pstate_id, powernv_pstate_info.nominal);
> +		i = powernv_pstate_info.max - powernv_pstate_info.nominal;

As of now the default loglevel corresponds to KERN_WARNING so this
warning should get printed anyway. However, don't you think it would
be better if we make it a pr_err( ) since it's a platform error that's
causing the pstate_id to go out of bounds ?

Otherwise it looks ok.

Acked-by: Gautham R. Shenoy <[email-masked]>

> +	}
> 
>  	return powernv_freqs[i].frequency;
>  }

--
Thanks and Regards
gautham.