There was a misplaced "+1" in my previous version of this patch (in lock_cmos()). Here is a corrected version...