]> Pileus Git - ~andy/linux/blobdiff - drivers/edac/edac_mc_sysfs.c
Merge branch 'for-3.8/drivers' of git://git.kernel.dk/linux-block
[~andy/linux] / drivers / edac / edac_mc_sysfs.c
index a242dae1aeb0ef2bc7d1131fdc8f0190dffd7a9c..de2df92f9c77126709d2c8388b2d88ba7f6ed55c 100644 (file)
@@ -846,14 +846,8 @@ static ssize_t edac_fake_inject_write(struct file *file,
        return count;
 }
 
-static int debugfs_open(struct inode *inode, struct file *file)
-{
-       file->private_data = inode->i_private;
-       return 0;
-}
-
 static const struct file_operations debug_fake_inject_fops = {
-       .open = debugfs_open,
+       .open = simple_open,
        .write = edac_fake_inject_write,
        .llseek = generic_file_llseek,
 };
@@ -1132,10 +1126,15 @@ int __init edac_mc_sysfs_init(void)
        edac_subsys = edac_get_sysfs_subsys();
        if (edac_subsys == NULL) {
                edac_dbg(1, "no edac_subsys\n");
-               return -EINVAL;
+               err = -EINVAL;
+               goto out;
        }
 
        mci_pdev = kzalloc(sizeof(*mci_pdev), GFP_KERNEL);
+       if (!mci_pdev) {
+               err = -ENOMEM;
+               goto out_put_sysfs;
+       }
 
        mci_pdev->bus = edac_subsys;
        mci_pdev->type = &mc_attr_type;
@@ -1144,11 +1143,18 @@ int __init edac_mc_sysfs_init(void)
 
        err = device_add(mci_pdev);
        if (err < 0)
-               return err;
+               goto out_dev_free;
 
        edac_dbg(0, "device %s created\n", dev_name(mci_pdev));
 
        return 0;
+
+ out_dev_free:
+       kfree(mci_pdev);
+ out_put_sysfs:
+       edac_put_sysfs_subsys();
+ out:
+       return err;
 }
 
 void __exit edac_mc_sysfs_exit(void)
@@ -1156,4 +1162,5 @@ void __exit edac_mc_sysfs_exit(void)
        put_device(mci_pdev);
        device_del(mci_pdev);
        edac_put_sysfs_subsys();
+       kfree(mci_pdev);
 }