Skip to content

Commit 4d59588

Browse files
Robert Richtersuryasaimadhu
authored andcommitted
EDAC/sysfs: Remove csrow objects on errors
All created csrow objects must be removed in the error path of edac_create_csrow_objects(). The objects have been added as devices. They need to be removed by doing a device_del() *and* put_device() call to also free their memory. The missing put_device() leaves a memory leak. Use device_unregister() instead of device_del() which properly unregisters the device doing both. Fixes: 7adc05d ("EDAC/sysfs: Drop device references properly") Signed-off-by: Robert Richter <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Tested-by: John Garry <[email protected]> Cc: <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 216aa14 commit 4d59588

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/edac/edac_mc_sysfs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,7 @@ static int edac_create_csrow_objects(struct mem_ctl_info *mci)
444444
csrow = mci->csrows[i];
445445
if (!nr_pages_per_csrow(csrow))
446446
continue;
447-
448-
device_del(&mci->csrows[i]->dev);
447+
device_unregister(&mci->csrows[i]->dev);
449448
}
450449

451450
return err;

0 commit comments

Comments
 (0)