if (!err) {
/* Init the MC's kobject */
memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj));
- kobject_init(&edac_memctrl_kobj);
-
edac_memctrl_kobj.parent = &edac_class.kset.kobj;
edac_memctrl_kobj.ktype = &ktype_memctrl;
/* Unregister the MC's kobject */
kobject_unregister(&edac_memctrl_kobj);
- /* release the master edac mc kobject */
- kobject_put(&edac_memctrl_kobj);
-
/* Unregister the 'edac' object */
sysdev_class_unregister(&edac_class);
#endif /* DISABLE_EDAC_SYSFS */
debugf1("%s()\n", __func__);
memset(&edac_pci_kobj, 0, sizeof(edac_pci_kobj));
-
- kobject_init(&edac_pci_kobj);
edac_pci_kobj.parent = &edac_class.kset.kobj;
edac_pci_kobj.ktype = &ktype_edac_pci;
debugf0("%s()\n", __func__);
kobject_unregister(&edac_pci_kobj);
- kobject_put(&edac_pci_kobj);
#endif
}
/* generate ..../edac/mc/mc<id>/csrow<index> */
- kobject_init(&csrow->kobj);
csrow->kobj.parent = edac_mci_kobj;
csrow->kobj.ktype = &ktype_csrow;
debugf0("%s() idx=%d\n", __func__, mci->mc_idx);
memset(edac_mci_kobj, 0, sizeof(*edac_mci_kobj));
- kobject_init(edac_mci_kobj);
/* set the name of the mc<id> object */
err = kobject_set_name(edac_mci_kobj,"mc%d",mci->mc_idx);
/* create a symlink for the device */
err = sysfs_create_link(edac_mci_kobj, &mci->pdev->dev.kobj,
EDAC_DEVICE_SYMLINK);
- if (err) {
- kobject_unregister(edac_mci_kobj);
- return err;
- }
+ if (err)
+ goto fail0;
/* Make directories for each CSROW object
* under the mc<id> kobject
if (csrow->nr_pages > 0) {
err = edac_create_csrow_object(edac_mci_kobj,csrow,i);
if (err)
- goto fail;
+ goto fail1;
}
}
/* CSROW error: backout what has already been registered, */
-fail:
+fail1:
for ( i--; i >= 0; i--) {
- if (csrow->nr_pages > 0) {
+ if (csrow->nr_pages > 0)
kobject_unregister(&mci->csrows[i].kobj);
- kobject_put(&mci->csrows[i].kobj);
- }
}
+fail0:
kobject_unregister(edac_mci_kobj);
- kobject_put(edac_mci_kobj);
return err;
}
/* remove all csrow kobjects */
for (i = 0; i < mci->nr_csrows; i++) {
- if (mci->csrows[i].nr_pages > 0) {
+ if (mci->csrows[i].nr_pages > 0)
kobject_unregister(&mci->csrows[i].kobj);
- kobject_put(&mci->csrows[i].kobj);
- }
}
sysfs_remove_link(&mci->edac_mci_kobj, EDAC_DEVICE_SYMLINK);
kobject_unregister(&mci->edac_mci_kobj);
- kobject_put(&mci->edac_mci_kobj);
#endif /* DISABLE_EDAC_SYSFS */
}