mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] MIPS: SGI-IP30: Free some unused memory
@ 2022-04-23 13:27 Christophe JAILLET
  2022-04-26 14:32 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-04-23 13:27 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-mips

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-ip30/ip30-xtalk.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/mips/sgi-ip30/ip30-xtalk.c b/arch/mips/sgi-ip30/ip30-xtalk.c
index 8a2894645529..8129524421cb 100644
--- a/arch/mips/sgi-ip30/ip30-xtalk.c
+++ b/arch/mips/sgi-ip30/ip30-xtalk.c
@@ -63,6 +63,8 @@ static void bridge_platform_create(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);
@@ -92,6 +94,8 @@ static void bridge_platform_create(int widget, int masterwid)
 	bd->io_offset	= IP30_SWIN_BASE(widget);
 
 	platform_device_add_data(pdev, bd, sizeof(*bd));
+	/* platform_device_add_data() duplicates the data */
+	kfree(bd);
 	platform_device_add(pdev);
 	pr_info("xtalk:%x bridge widget\n", widget);
 	return;
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] MIPS: SGI-IP30: Free some unused memory
  2022-04-23 13:27 [PATCH] MIPS: SGI-IP30: Free some unused memory Christophe JAILLET
@ 2022-04-26 14:32 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2022-04-26 14:32 UTC (permalink / raw)
  To: Christophe JAILLET; +Cc: linux-kernel, kernel-janitors, linux-mips

On Sat, Apr 23, 2022 at 03:27:58PM +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-ip30/ip30-xtalk.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/mips/sgi-ip30/ip30-xtalk.c b/arch/mips/sgi-ip30/ip30-xtalk.c
> index 8a2894645529..8129524421cb 100644
> --- a/arch/mips/sgi-ip30/ip30-xtalk.c
> +++ b/arch/mips/sgi-ip30/ip30-xtalk.c
> @@ -63,6 +63,8 @@ static void bridge_platform_create(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);
> @@ -92,6 +94,8 @@ static void bridge_platform_create(int widget, int masterwid)
>  	bd->io_offset	= IP30_SWIN_BASE(widget);
>  
>  	platform_device_add_data(pdev, bd, sizeof(*bd));
> +	/* platform_device_add_data() duplicates the data */
> +	kfree(bd);
>  	platform_device_add(pdev);
>  	pr_info("xtalk:%x bridge widget\n", 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 ]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-26 14:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-23 13:27 [PATCH] MIPS: SGI-IP30: Free some unused memory Christophe JAILLET
2022-04-26 14:32 ` Thomas Bogendoerfer

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®