Linux EDAC development
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Qiushi Wu <wu000273@umn.edu>, linux-edac@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Borislav Petkov <bp@alien8.de>,
	Doug Thompson <dougthompson@xmission.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	James Morse <james.morse@arm.com>, Kangjie Lu <kjlu@umn.edu>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Robert Richter <rrichter@marvell.com>,
	Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj()
Date: Fri, 29 May 2020 11:20:42 +0200	[thread overview]
Message-ID: <28ebc99f-c0dd-00b2-7a53-9edf0df36c9c@web.de> (raw)

…
> +++ 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

             reply	other threads:[~2020-05-29  9:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-29  9:20 Markus Elfring [this message]
2020-05-29  9:36 ` [PATCH] edac: Fix reference count leak in edac_device_register_sysfs_main_kobj() Borislav Petkov
2020-05-29  9:40   ` Markus Elfring
2020-05-29  9:47     ` Borislav Petkov
2020-05-29 10:40       ` Markus Elfring
2020-05-29 11:50         ` Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2020-05-29  8:45 [PATCH] " Markus Elfring
2020-05-29  9:08 ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28ebc99f-c0dd-00b2-7a53-9edf0df36c9c@web.de \
    --to=markus.elfring@web.de \
    --cc=bp@alien8.de \
    --cc=dougthompson@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=james.morse@arm.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=kjlu@umn.edu \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rrichter@marvell.com \
    --cc=tony.luck@intel.com \
    --cc=wu000273@umn.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox