提交 a28dbea0 编写于 作者: B Brian Harring 提交者: Samuel Ortiz

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: NBrian Harring <ferringb@gmail.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 11c39c4b
...@@ -38,10 +38,12 @@ static int mfd_add_device(struct device *parent, int id, ...@@ -38,10 +38,12 @@ static int mfd_add_device(struct device *parent, int id,
pdev->dev.parent = parent; pdev->dev.parent = parent;
platform_set_drvdata(pdev, cell->driver_data); platform_set_drvdata(pdev, cell->driver_data);
ret = platform_device_add_data(pdev, if (cell->data_size) {
cell->platform_data, cell->data_size); ret = platform_device_add_data(pdev,
if (ret) cell->platform_data, cell->data_size);
goto fail_res; if (ret)
goto fail_res;
}
for (r = 0; r < cell->num_resources; r++) { for (r = 0; r < cell->num_resources; r++) {
res[r].name = cell->resources[r].name; res[r].name = cell->resources[r].name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册