[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <28ebc99f-c0dd-00b2-7a53-9edf0df36c9c@web.de>
Date: Fri, 29 May 2020 11:20:42 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Qiushi Wu <wu000273@....edu>, linux-edac@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Borislav Petkov <bp@...en8.de>,
Doug Thompson <dougthompson@...ssion.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
James Morse <james.morse@....com>, Kangjie Lu <kjlu@....edu>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Robert Richter <rrichter@...vell.com>,
Tony Luck <tony.luck@...el.com>
Subject: Re: [PATCH] edac: Fix reference count leak in
edac_device_register_sysfs_main_kobj()
…
> +++ 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?
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
Powered by blists - more mailing lists