From: Mauro Carvalho Chehab <mchehab@redhat.com> Date: Tue, 23 Nov 2010 17:33:54 -0500 Subject: [edac] i7core_edac: fix line order in i7core_register_mci Message-id: <20101123153354.02c8db81@pedra> Patchwork-id: 29571 O-Subject: [PATCH RHEL5 16/29] BZ#:651869 i7core_edac: Fix order of lines in i7core_register_mci Bugzilla: 651869 RH-Acked-by: Aristeu Rozanski <aris@redhat.com> Changeset: 5939813b9c4270d0f46375c3cad64226bb1fcd62 The flag is_registered is not initialized until mci_bind_devs() is called. Refer it properly. The mci->dev and mci->edac_check is required in edac_mc_add_mc(), so prepare them just before the call. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Jarod Wilson <jarod@redhat.com> diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c index 23a3880..012ccf2 100644 --- a/drivers/edac/i7core_edac.c +++ b/drivers/edac/i7core_edac.c @@ -1923,9 +1923,6 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev, debugf0("MC: " __FILE__ ": %s(): mci = %p, dev = %p\n", __func__, mci, &i7core_dev->pdev[0]->dev); - /* record ptr to the generic device */ - mci->dev = &i7core_dev->pdev[0]->dev; - pvt = mci->pvt_info; memset(pvt, 0, sizeof(*pvt)); @@ -1957,8 +1954,17 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev, if (unlikely(rc < 0)) goto fail; + if (pvt->is_registered) + mci->mc_driver_sysfs_attributes = i7core_sysfs_rdimm_attrs; + else + mci->mc_driver_sysfs_attributes = i7core_sysfs_udimm_attrs; + /* Get dimm basic config */ get_dimm_config(mci, &csrow); + /* record ptr to the generic device */ + mci->dev = &i7core_dev->pdev[0]->dev; + /* Set the function pointer to an actual operation function */ + mci->edac_check = i7core_check_error; /* add this new MC control structure to EDAC's list of MCs */ if (unlikely(edac_mc_add_mc(mci, i7core_dev->socket))) {