Re: [PATCH v4 1/2] OMAP3: SDRC: Dynamic Calculation of SDRC stall latency during DVFS

Kevin Hilman
2010-03-18T14:48:31Z

"G, Manjunath Kondaiah" <manjugk@ti.com> writes:

>> +#ifdef CONFIG_ARCH_OMAP3
>> +void (*_omap3_sram_delay)(unsigned int);
>> +unsigned int measure_sram_delay(unsigned int loop)
>> +{
>> + static struct omap_dm_timer *gpt;
>> + unsigned long flags, diff = 0, gt_rate, mpurate;
>> + unsigned int delay_sram, error_gain;
>> + unsigned int start = 0, end = 0;
>> +
>> + omap_dm_timer_init();
>> + gpt = omap_dm_timer_request();
>> + if (!gpt) {
>
> Request timer API returns NULL on failure.
> Use BUG_ON(gpt == NULL);

No. BUG_ON() will panic the kernel and hang here. There is no need
to crash the kernel for that.

Current aproach is fine, or if a more verbose warning is desired,
you can use if (WARN_ON(!gpt)) ... and drop the pr_err()

Kevin