From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-mips@vger.kernel.org
Subject: Re: [PATCH] MIPS: SGI-IP27: Free some unused memory
Date: Tue, 26 Apr 2022 16:32:01 +0200 [thread overview]
Message-ID: <20220426143201.GD18291@alpha.franken.de> (raw)
In-Reply-To: <9bc24670be4b1386c9b5c60f158c6acd7b723e72.1650720222.git.christophe.jaillet@wanadoo.fr>
On Sat, Apr 23, 2022 at 03:24:03PM +0200, Christophe JAILLET wrote:
> platform_device_add_data() duplicates the memory it is passed. So we can
> free some memory to save a few bytes that would remain unused otherwise.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> arch/mips/sgi-ip27/ip27-xtalk.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/mips/sgi-ip27/ip27-xtalk.c b/arch/mips/sgi-ip27/ip27-xtalk.c
> index 000ede156bdc..e762886d1dda 100644
> --- a/arch/mips/sgi-ip27/ip27-xtalk.c
> +++ b/arch/mips/sgi-ip27/ip27-xtalk.c
> @@ -53,6 +53,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid)
> }
> platform_device_add_resources(pdev, &w1_res, 1);
> platform_device_add_data(pdev, wd, sizeof(*wd));
> + /* platform_device_add_data() duplicates the data */
> + kfree(wd);
> platform_device_add(pdev);
>
> bd = kzalloc(sizeof(*bd), GFP_KERNEL);
> @@ -83,6 +85,8 @@ static void bridge_platform_create(nasid_t nasid, int widget, int masterwid)
> bd->io_offset = offset;
>
> platform_device_add_data(pdev, bd, sizeof(*bd));
> + /* platform_device_add_data() duplicates the data */
> + kfree(bd);
> platform_device_add(pdev);
> pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget);
> return;
> --
> 2.32.0
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
prev parent reply other threads:[~2022-04-26 14:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-23 13:24 [PATCH] MIPS: SGI-IP27: Free some unused memory Christophe JAILLET
2022-04-26 14:32 ` Thomas Bogendoerfer [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=20220426143201.GD18291@alpha.franken.de \
--to=tsbogend@alpha.franken.de \
--cc=christophe.jaillet@wanadoo.fr \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@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;
as well as URLs for NNTP newsgroup(s).