[lm-sensors] [RFC/PATCH] hwmon: fix common race conditions, batch 1

Darrick J. Wong djwong at us.ibm.com
Thu Mar 6 20:49:50 CET 2008


On Thu, Mar 06, 2008 at 09:06:09AM -0500, Mark M. Hoffman wrote:
> Hi Darrick:
> Notice how encode_temp() above is outside of the locked section.  It is
> instructive for potential reviewers of this patch series to see just how easy
> it is to miss these.

Yep...

> REG_CFG5 (from which temp_twos_complement is updated) is never written.  Do you
> really need to read that during every update?  If you move that one read into
> the init routine, that will instantly kill all the race conditions associated
> with temp_twos_complement (assuming the hardware does not modify this register
> behind our backs).  What do you think?

Correct, the hardware doesn't modify that register at all.  I see your
patch, so I'll have a look through that.

--D



More information about the lm-sensors mailing list