Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357586
b: refs/heads/master
c: 7e2e6c5
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Samuel Ortiz committed Feb 13, 2013
1 parent b45b6f9 commit dd1d084
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e581238f2817d8ca8948340a2bc26dd9504bb812
refs/heads/master: 7e2e6c5758de94ec22686b30e7b906a3ddcd9896
31 changes: 7 additions & 24 deletions trunk/drivers/mfd/twl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,11 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
int status;
unsigned i, num_slaves;

if (!node && !pdata) {
dev_err(&client->dev, "no platform data\n");
return -EINVAL;
}

pdev = platform_device_alloc(DRIVER_NAME, -1);
if (!pdev) {
dev_err(&client->dev, "can't alloc pdev\n");
Expand All @@ -1177,28 +1182,6 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
return status;
}

if (node && !pdata) {
/*
* XXX: Temporary pdata until the information is correctly
* retrieved by every TWL modules from DT.
*/
pdata = devm_kzalloc(&client->dev,
sizeof(struct twl4030_platform_data),
GFP_KERNEL);
if (!pdata) {
status = -ENOMEM;
goto free;
}
}

if (!pdata) {
dev_dbg(&client->dev, "no platform data?\n");
status = -EINVAL;
goto free;
}

platform_set_drvdata(pdev, pdata);

if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C) == 0) {
dev_dbg(&client->dev, "can't talk I2C?\n");
status = -EIO;
Expand Down Expand Up @@ -1264,7 +1247,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
inuse = true;

/* setup clock framework */
clocks_init(&pdev->dev, pdata->clock);
clocks_init(&pdev->dev, pdata ? pdata->clock : NULL);

/* read TWL IDCODE Register */
if (twl_id == TWL4030_CLASS_ID) {
Expand All @@ -1273,7 +1256,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
}

/* load power event scripts */
if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata->power)
if (IS_ENABLED(CONFIG_TWL4030_POWER) && pdata && pdata->power)
twl4030_power_init(pdata->power);

/* Maybe init the T2 Interrupt subsystem */
Expand Down

0 comments on commit dd1d084

Please sign in to comment.