mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Zhe Qiao <qiaozhe@iscas.ac.cn>,
	linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>, Len Brown <lenb@kernel.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: [PATCH] ACPI: pci: Release excess memory usage
Date: Mon, 28 Apr 2025 18:35:43 +0200	[thread overview]
Message-ID: <242118cf-4dee-4a94-8036-645d7fae2efb@web.de> (raw)
In-Reply-To: <20250428085610.727327-1-qiaozhe@iscas.ac.cn>

> In the pci_acpi_scan_root() function, if the PCI bus creation fails,

                                                                failed?


> the allocated memory should be released to avoid memory occupation.

Do you propose to complete the exception handling?

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.15-rc4#n145

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.15-rc4#n94> +++ b/drivers/pci/pci-acpi.c
> @@ -1710,6 +1708,11 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
>  		pcie_bus_configure_settings(child);
>  
>  	return bus;
> +
> +cleanup_exit:

How do you think about to use the label “free_root_ops”?


> +	kfree(root_ops);

I suggest to use another label “free_ri” so that a bit of duplicate exception handling code
can be avoided from a previous if branch.


> +	kfree(ri);
> +	return NULL;
>  }
…

How do you think about to benefit any more from the application of the attribute “__free”?
https://elixir.bootlin.com/linux/v6.15-rc4/source/include/linux/slab.h#L476

Regards,
Markus

      reply	other threads:[~2025-04-28 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28  8:56 Zhe Qiao
2025-04-28 16:35 ` Markus Elfring [this message]

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=242118cf-4dee-4a94-8036-645d7fae2efb@web.de \
    --to=markus.elfring@web.de \
    --cc=bhelgaas@google.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=qiaozhe@iscas.ac.cn \
    --cc=rafael@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®