mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Guangshuo Li <lgs201920130244@gmail.com>,
	kernel-janitors@vger.kernel.org, Dan Williams <djbw@kernel.org>,
	Kees Cook <kees@kernel.org>,
	Maciej Sosnowski <maciej.sosnowski@intel.com>
Cc: stable@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dca: fix provider device memory leak on domain allocation failure
Date: Mon, 21 Sep 2026 13:30:17 +0200	[thread overview]
Message-ID: <4d1536a9-6836-430b-a84d-aaa19f6af9c6@web.de> (raw)
In-Reply-To: <20260919175925.3739806-1-lgs201920130244@gmail.com>

…
> +++ b/drivers/dca/dca-core.c
> @@ -368,8 +368,11 @@ int register_dca_provider(struct dca_provider *dca, struct device *dev)
>  		raw_spin_unlock_irqrestore(&dca_lock, flags);
>  		rc = dca_pci_rc_from_dev(dev);
>  		newdomain = dca_allocate_domain(rc);
> -		if (!newdomain)
> +		if (!newdomain) {
> +			dca_sysfs_remove_provider(dca);
>  			return -ENODEV;
> +		}
> +
>  		raw_spin_lock_irqsave(&dca_lock, flags);
…

Please avoid a bit of duplicate source code in this function implementation
by using another goto chain.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.3-rc4#n572

https://elixir.bootlin.com/linux/v7.3-rc3/source/drivers/dca/dca-core.c#L335-L389

Regards,
Markus

  reply	other threads:[~2026-09-21 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-19 17:59 Guangshuo Li
2026-09-21 11:30 ` Markus Elfring [this message]
2026-09-21 15:12 ` krzk
2026-09-22  2:48   ` Guangshuo Li

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=4d1536a9-6836-430b-a84d-aaa19f6af9c6@web.de \
    --to=markus.elfring@web.de \
    --cc=djbw@kernel.org \
    --cc=kees@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.sosnowski@intel.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®