MIPS: SGI-IP27: Free some unused memory
[ Upstream commit33d7085682] 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> Stable-dep-of:11bec9cba4("MIPS: SGI-IP27: Fix platform-device leak in bridge_platform_create()") Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
3598445698
commit
0c667858c0
@@ -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_resources(pdev, &w1_res, 1);
|
||||||
platform_device_add_data(pdev, wd, sizeof(*wd));
|
platform_device_add_data(pdev, wd, sizeof(*wd));
|
||||||
|
/* platform_device_add_data() duplicates the data */
|
||||||
|
kfree(wd);
|
||||||
platform_device_add(pdev);
|
platform_device_add(pdev);
|
||||||
|
|
||||||
bd = kzalloc(sizeof(*bd), GFP_KERNEL);
|
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;
|
bd->io_offset = offset;
|
||||||
|
|
||||||
platform_device_add_data(pdev, bd, sizeof(*bd));
|
platform_device_add_data(pdev, bd, sizeof(*bd));
|
||||||
|
/* platform_device_add_data() duplicates the data */
|
||||||
|
kfree(bd);
|
||||||
platform_device_add(pdev);
|
platform_device_add(pdev);
|
||||||
pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget);
|
pr_info("xtalk:n%d/%x bridge widget\n", nasid, widget);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user