aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mfd-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/mfd-core.c')
-rw-r--r--drivers/mfd/mfd-core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index d01574d98870..f4c8c844b913 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -55,6 +55,19 @@ int mfd_cell_disable(struct platform_device *pdev)
55} 55}
56EXPORT_SYMBOL(mfd_cell_disable); 56EXPORT_SYMBOL(mfd_cell_disable);
57 57
58static int mfd_platform_add_cell(struct platform_device *pdev,
59 const struct mfd_cell *cell)
60{
61 if (!cell)
62 return 0;
63
64 pdev->mfd_cell = kmemdup(cell, sizeof(*cell), GFP_KERNEL);
65 if (!pdev->mfd_cell)
66 return -ENOMEM;
67
68 return 0;
69}
70
58static int mfd_add_device(struct device *parent, int id, 71static int mfd_add_device(struct device *parent, int id,
59 const struct mfd_cell *cell, 72 const struct mfd_cell *cell,
60 struct resource *mem_base, 73 struct resource *mem_base,
@@ -75,7 +88,7 @@ static int mfd_add_device(struct device *parent, int id,
75 88
76 pdev->dev.parent = parent; 89 pdev->dev.parent = parent;
77 90
78 ret = platform_device_add_data(pdev, cell, sizeof(*cell)); 91 ret = mfd_platform_add_cell(pdev, cell);
79 if (ret) 92 if (ret)
80 goto fail_res; 93 goto fail_res;
81 94
@@ -123,7 +136,6 @@ static int mfd_add_device(struct device *parent, int id,
123 136
124 return 0; 137 return 0;
125 138
126/* platform_device_del(pdev); */
127fail_res: 139fail_res:
128 kfree(res); 140 kfree(res);
129fail_device: 141fail_device: