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

Gautham R Shenoy ego at linux.vnet.ibm.com
Mon Aug 4 18:10:44 EST 2014


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 <ego at linux.vnet.ibm.com>

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


--
Thanks and Regards
gautham.



More information about the Linuxppc-dev mailing list