Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a28dbea0 authored by Brian Harring's avatar Brian Harring Committed by Samuel Ortiz
Browse files

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: default avatarBrian Harring <ferringb@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 11c39c4b
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -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);

	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;