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

Commit 6382a061 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Samuel Ortiz
Browse files

mfd: twl-core: Move 'inuse' check early at probe time



We can fail earlier in case multiple instance of the twl-core is tried to
be loaded.
The twl-core by design only supports one instance.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 7e2e6c57
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1170,6 +1170,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
		return -EINVAL;
	}

	if (inuse) {
		dev_dbg(&client->dev, "only one instance of %s allowed\n",
			DRIVER_NAME);
		return -EBUSY;
	}

	pdev = platform_device_alloc(DRIVER_NAME, -1);
	if (!pdev) {
		dev_err(&client->dev, "can't alloc pdev\n");
@@ -1188,12 +1194,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
		goto free;
	}

	if (inuse) {
		dev_dbg(&client->dev, "driver is already in use\n");
		status = -EBUSY;
		goto free;
	}

	if ((id->driver_data) & TWL6030_CLASS) {
		twl_id = TWL6030_CLASS_ID;
		twl_map = &twl6030_map[0];