aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/edac/edac_mc.c45
1 files changed, 27 insertions, 18 deletions
diff --git a/drivers/edac/edac_mc.c b/drivers/edac/edac_mc.c
index 4bde30bb3be7..75e9e38330ff 100644
--- a/drivers/edac/edac_mc.c
+++ b/drivers/edac/edac_mc.c
@@ -230,34 +230,43 @@ static struct kobj_type ktype_memctrl = {
230 */ 230 */
231static int edac_sysfs_memctrl_setup(void) 231static int edac_sysfs_memctrl_setup(void)
232{ 232{
233 int err=0; 233 int err = 0;
234 234
235 debugf1("%s()\n", __func__); 235 debugf1("%s()\n", __func__);
236 236
237 /* create the /sys/devices/system/edac directory */ 237 /* create the /sys/devices/system/edac directory */
238 err = sysdev_class_register(&edac_class); 238 err = sysdev_class_register(&edac_class);
239 239
240 if (!err) { 240 if (err) {
241 /* Init the MC's kobject */ 241 debugf1("%s() error=%d\n", __func__, err);
242 memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj)); 242 return err;
243 edac_memctrl_kobj.parent = &edac_class.kset.kobj; 243 }
244 edac_memctrl_kobj.ktype = &ktype_memctrl;
245 244
246 /* generate sysfs "..../edac/mc" */ 245 /* Init the MC's kobject */
247 err = kobject_set_name(&edac_memctrl_kobj,"mc"); 246 memset(&edac_memctrl_kobj, 0, sizeof (edac_memctrl_kobj));
247 edac_memctrl_kobj.parent = &edac_class.kset.kobj;
248 edac_memctrl_kobj.ktype = &ktype_memctrl;
248 249
249 if (!err) { 250 /* generate sysfs "..../edac/mc" */
250 /* FIXME: maybe new sysdev_create_subdir() */ 251 err = kobject_set_name(&edac_memctrl_kobj,"mc");
251 err = kobject_register(&edac_memctrl_kobj);
252 252
253 if (err) 253 if (err)
254 debugf1("Failed to register '.../edac/mc'\n"); 254 goto fail;
255 else 255
256 debugf1("Registered '.../edac/mc' kobject\n"); 256 /* FIXME: maybe new sysdev_create_subdir() */
257 } 257 err = kobject_register(&edac_memctrl_kobj);
258 } else 258
259 debugf1("%s() error=%d\n", __func__, err); 259 if (err) {
260 debugf1("Failed to register '.../edac/mc'\n");
261 goto fail;
262 }
260 263
264 debugf1("Registered '.../edac/mc' kobject\n");
265
266 return 0;
267
268fail:
269 sysdev_class_unregister(&edac_class);
261 return err; 270 return err;
262} 271}
263 272