edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
Subsystems (2)
…
Review int edac_device_register_sysfs_main_kobj(struct edac_device_ctl_info *edac_dev) · line 281
Quoted 9 lines
+++
b/drivers/edac/edac_device_sysfs.c(quoted diff) +1
-0@@ -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?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=75caf310d16cc5e2f851c048cd597f5437013368#n456
* 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).
Regards,
Markus
Borislav Petkov
maintainerQuoted 2 lines · Markus Elfring
* The label “err_out” can be replaced by direct return statement, can't it?
No, it cannot. It keeps the error handling code out-of-line so that the function body remains readable.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 5 lines
Quoted 2 lines
* The label “err_out” can be replaced by direct return statement, can't it?
No, it cannot. It keeps the error handling code out-of-line so that the function body remains readable.
Have we got different programming expectations also around the application of the Linux coding style?
Regards,
Markus
Borislav Petkov
maintainerQuoted 2 lines · Markus Elfring
Have we got different programming expectations also around the application of the Linux coding style?
We have me stopping you from giving new submitters wrong review and bad advice.
Please refrain from "reviewing" EDAC patches!
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 1 line
We have me stopping you from giving new submitters wrong review
I do not find my suggestions wrong for this issue.
Quoted 1 line
and bad advice.
But I can understand that we might occasionally prefer other software development approaches.
Quoted 1 line
Please refrain from "reviewing" EDAC patches!
Would you prefer to clarify any remaining adjustments from my selection of change possibilities?
https://lore.kernel.org/linux-edac/[email protected]/
https://lore.kernel.org/patchwork/patch/1130412/
https://lkml.org/lkml/2019/9/21/121
Regards,
Markus
Borislav Petkov
maintainerWhich part of
"Please refrain from "reviewing" EDAC patches!"
don't you understand?
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette