aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/mfd-core.c
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2010-10-19 01:21:06 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2010-10-29 00:30:03 +0200
commita28dbea0ad3bd8144f3348eb5c20fabc2f12b4b5 (patch)
treed65e247eca308c886f9ebf966ab1353396bb7e61 /drivers/mfd/mfd-core.c
parentmfd: Add twl4030_bci platform_data back (diff)
downloadlinux-dev-a28dbea0ad3bd8144f3348eb5c20fabc2f12b4b5.tar.xz
linux-dev-a28dbea0ad3bd8144f3348eb5c20fabc2f12b4b5.zip
mfd: Add devices platform data when the cell data size is not 0
When the cell data_size is 0, the resulting platform_data pointer will be set to ZERO_SIZE_PTR. That could be misleading for device drivers running a NULL check on thei platform_data pointer before dereferencing it. Signed-off-by: Brian Harring <ferringb@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/mfd/mfd-core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index d1c8605d4ed4..ec99f681e773 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -38,10 +38,12 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.parent = parent;
platform_set_drvdata(pdev, cell->driver_data);
- ret = platform_device_add_data(pdev,
- cell->platform_data, cell->data_size);
- if (ret)
- goto fail_res;
+ if (cell->data_size) {
+ ret = platform_device_add_data(pdev,
+ cell->platform_data, cell->data_size);
+ if (ret)
+ goto fail_res;
+ }
for (r = 0; r < cell->num_resources; r++) {
res[r].name = cell->resources[r].name;