Qiushi Wu 17ed808ad2 EDAC: Fix reference count leaks
When kobject_init_and_add() returns an error, it should be handled
because kobject_init_and_add() takes a reference even when it fails. If
this function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.

Therefore, replace calling kfree() and call kobject_put() and add a
missing kobject_put() in the edac_device_register_sysfs_main_kobj()
error path.

 [ bp: Massage and merge into a single patch. ]

Fixes: b2ed215a3338 ("Kobject: change drivers/edac to use kobject_init_and_add")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/20200528202238.18078-1-wu000273@umn.edu
Link: https://lkml.kernel.org/r/20200528203526.20908-1-wu000273@umn.edu
2020-06-17 15:38:35 +02:00
..
2017-07-17 13:42:48 +02:00
2020-02-19 21:00:27 +01:00
2017-07-17 13:42:48 +02:00
2017-07-17 13:42:48 +02:00
2017-07-17 13:42:48 +02:00
2020-02-19 21:00:27 +01:00
2011-04-19 00:23:22 +02:00
2017-07-17 13:42:48 +02:00