platform_device_add_data copies the data, so no need for
kmalloc.
Signed-off-by: Tim Niemeyer <[email protected]>
---
drivers/mfd/pcf50606-core.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/mfd/pcf50606-core.c b/drivers/mfd/pcf50606-core.c
index 994d6f4..9d0bdae 100644
--- a/drivers/mfd/pcf50606-core.c
+++ b/drivers/mfd/pcf50606-core.c
@@ -436,7 +436,7 @@ static void
pcf50606_client_dev_register(struct pcf50606 *pcf, const char *name,
struct platform_device **pdev)
{
- struct pcf50606_subdev_pdata *subdev_pdata;
+ struct pcf50606_subdev_pdata subdev_pdata;
int ret;
*pdev = platform_device_alloc(name, -1);
@@ -445,14 +445,8 @@ pcf50606_client_dev_register(struct pcf50606 *pcf, const char *name,
return;
}
- subdev_pdata = kmalloc(sizeof(*subdev_pdata), GFP_KERNEL);
- if (!subdev_pdata) {
- dev_err(pcf->dev, "Error allocating subdev pdata\n");
- platform_device_put(*pdev);
- }
-
- subdev_pdata->pcf = pcf;
- platform_device_add_data(*pdev, subdev_pdata, sizeof(*subdev_pdata));
+ subdev_pdata.pcf = pcf;
+ platform_device_add_data(*pdev, &subdev_pdata, sizeof(subdev_pdata));
(*pdev)->dev.parent = pcf->dev;