aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-10-08 12:11:08 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-10 10:49:31 -0400
commit321ece4dda32f52d4a28d6eb11f2ca2a5c93c191 (patch)
tree7f6919a216d317799d1de120c98a6ab007a51410 /drivers
parent6e103be1c7c4adb50f25aaf1f1e8f828833c1719 (diff)
i7core_edac: Fix ringbuffer maxsize
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/edac/i7core_edac.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 59ec44175560..c2857f60ae6a 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1631,14 +1631,14 @@ static void i7core_check_error(struct mem_ctl_info *mci)
1631 * loosing an error. 1631 * loosing an error.
1632 */ 1632 */
1633 smp_rmb(); 1633 smp_rmb();
1634 count = (pvt->mce_out + sizeof(mce_entry) - pvt->mce_in) 1634 count = (pvt->mce_out + MCE_LOG_LEN - pvt->mce_in)
1635 % sizeof(mce_entry); 1635 % MCE_LOG_LEN;
1636 if (!count) 1636 if (!count)
1637 return; 1637 return;
1638 1638
1639 m = pvt->mce_outentry; 1639 m = pvt->mce_outentry;
1640 if (pvt->mce_in + count > sizeof(mce_entry)) { 1640 if (pvt->mce_in + count > MCE_LOG_LEN) {
1641 unsigned l = sizeof(mce_entry) - pvt->mce_in; 1641 unsigned l = MCE_LOG_LEN - pvt->mce_in;
1642 1642
1643 memcpy(m, &pvt->mce_entry[pvt->mce_in], sizeof(*m) * l); 1643 memcpy(m, &pvt->mce_entry[pvt->mce_in], sizeof(*m) * l);
1644 smp_wmb(); 1644 smp_wmb();
@@ -1702,7 +1702,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
1702 return 0; 1702 return 0;
1703 1703
1704 smp_rmb(); 1704 smp_rmb();
1705 if ((pvt->mce_out + 1) % sizeof(mce_entry) == pvt->mce_in) { 1705 if ((pvt->mce_out + 1) % MCE_LOG_LEN == pvt->mce_in) {
1706 smp_wmb(); 1706 smp_wmb();
1707 pvt->mce_overrun++; 1707 pvt->mce_overrun++;
1708 return 0; 1708 return 0;
@@ -1711,7 +1711,7 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
1711 /* Copy memory error at the ringbuffer */ 1711 /* Copy memory error at the ringbuffer */
1712 memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce)); 1712 memcpy(&pvt->mce_entry[pvt->mce_out], mce, sizeof(*mce));
1713 smp_wmb(); 1713 smp_wmb();
1714 pvt->mce_out = (pvt->mce_out + 1) % sizeof(mce_entry); 1714 pvt->mce_out = (pvt->mce_out + 1) % MCE_LOG_LEN;
1715 1715
1716 /* Handle fatal errors immediately */ 1716 /* Handle fatal errors immediately */
1717 if (mce->mcgstatus & 1) 1717 if (mce->mcgstatus & 1)