Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()

From: Markus Elfring
Date: Fri May 29 2020 - 05:21:23 EST

> +++ b/drivers/edac/edac_device_sysfs.c
> @@ -275,6 +275,7 @@ int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev)
> /* Error exit stack */
> err_kobj_reg:
> + kobject_put(&edac_dev->kobj);
> module_put(edac_dev->owner);
> err_out:

I suggest to modify the affected source code in a different way.

* The label âerr_outâ can be replaced by direct return statement,
can't it?

* I interpret the function implementation in the way
that that there is only one if branch where clean-up of
system resources is needed.
Thus I would prefer to specify corresponding complete exception handling
directly at this place (instead of using the goto statement).