lkml.org 
[lkml]   [2012]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [lm-sensors] [PATCH] hwmon: coretemp: use list instead of fixed size array for temp data
On Thu, May 03, 2012 at 05:29:43AM +0000, R, Durgadoss wrote:
> > @@ -707,14 +787,12 @@ static void __cpuinit put_core_offline(unsigned int cpu)
> >
> > pdata = platform_get_drvdata(pdev);
> >
> > - indx = TO_ATTR_NO(cpu);
> > -
> > - /* The core id is too big, just return */
> > - if (indx > MAX_CORE_DATA - 1)
> > - return;
> > + attr_no = TO_ATTR_NO(cpu);
> >
> > - if (pdata->core_data[indx] && pdata->core_data[indx]->cpu == cpu)
> > - coretemp_remove_core(pdata, &pdev->dev, indx);
> > + tdata = get_temp_data(pdata, attr_no);
> > + if (tdata->cpu == cpu)
>
> The get_temp_data can return a NULL. So, you might want to do,
> if (tdata && tdata->cpu == cpu) to avoid a potential NULL ptr crash.

Good catch, thanks.

> In general, why are we using spin_locks instead of mutex_locks,
> for list manipulations .. ?

I don't think it matters here. Contention is low and nobody sleeps, but
okay, I'll change it to mutex.

--
Kirill A. Shutemov
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-05-03 12:41    [from the cache]
©2003-2011 Jasper Spaans