Skip to content

Commit

Permalink
MIPS: SGI-IP30: Free some unused memory
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  • Loading branch information
tititiou36 authored and tsbogend committed Apr 26, 2022
1 parent 33d7085 commit fd27234
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/mips/sgi-ip30/ip30-xtalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit fd27234

Please sign in to comment.