i7core_edac: fix panic when accessing sysfs files
authorPrarit Bhargava <prarit@redhat.com>
Tue, 16 Oct 2012 13:02:27 +0000 (09:02 -0400)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 28 Nov 2012 08:56:00 +0000 (06:56 -0200)
The i7core_edac addrmatch_dev and chancounts_dev have sysfs files
associated with them.  The sysfs files, however, are coded so that the
parent device is is the mci device.  This is incorrect and the mci struct
should be obtained through the addrmatch_dev and chancounts_dev device's
private data field which is populated in i7core_create_sysfs_devices().

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/edac/i7core_edac.c

index 3672101023bd8d44c7fb136601a72a0290a9e936..10c8c00d6469398a211dc23b413d4d6495851b5a 100644 (file)
@@ -816,7 +816,7 @@ static ssize_t i7core_inject_store_##param(                 \
        struct device_attribute *mattr,                         \
        const char *data, size_t count)                         \
 {                                                              \
-       struct mem_ctl_info *mci = to_mci(dev);                 \
+       struct mem_ctl_info *mci = dev_get_drvdata(dev);        \
        struct i7core_pvt *pvt;                                 \
        long value;                                             \
        int rc;                                                 \
@@ -845,7 +845,7 @@ static ssize_t i7core_inject_show_##param(                  \
        struct device_attribute *mattr,                         \
        char *data)                                             \
 {                                                              \
-       struct mem_ctl_info *mci = to_mci(dev);                 \
+       struct mem_ctl_info *mci = dev_get_drvdata(dev);        \
        struct i7core_pvt *pvt;                                 \
                                                                \
        pvt = mci->pvt_info;                                    \
@@ -1052,7 +1052,7 @@ static ssize_t i7core_show_counter_##param(                       \
        struct device_attribute *mattr,                         \
        char *data)                                             \
 {                                                              \
-       struct mem_ctl_info *mci = to_mci(dev);                 \
+       struct mem_ctl_info *mci = dev_get_drvdata(dev);        \
        struct i7core_pvt *pvt = mci->pvt_info;                 \
                                                                \
        edac_dbg(1, "\n");                                      \