diff options
author | David S. Miller <davem@davemloft.net> | 2010-03-15 23:23:54 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-15 23:23:54 (GMT) |
commit | 4961e02f1999e1c3468c09b2669c94d7c3ae82a8 (patch) | |
tree | 44c15abb09d7ba5e17a9aba95ee246648b1c1a8a /drivers/regulator/tps65023-regulator.c | |
parent | d14a0ebda7d3daede1a99c01527affb9ceaa4c22 (diff) | |
parent | a3d3203e4bb40f253b1541e310dc0f9305be7c84 (diff) | |
download | linux-fsl-qoriq-4961e02f1999e1c3468c09b2669c94d7c3ae82a8.tar.xz |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/regulator/tps65023-regulator.c')
-rw-r--r-- | drivers/regulator/tps65023-regulator.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index 07fda0a..1f18354 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c @@ -457,8 +457,8 @@ static struct regulator_ops tps65023_ldo_ops = { .list_voltage = tps65023_ldo_list_voltage, }; -static -int tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) +static int __devinit tps_65023_probe(struct i2c_client *client, + const struct i2c_device_id *id) { static int desc_id; const struct tps_info *info = (void *)id->driver_data; @@ -466,6 +466,7 @@ int tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) struct regulator_dev *rdev; struct tps_pmic *tps; int i; + int error; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; @@ -475,7 +476,6 @@ int tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) * coming from the board-evm file. */ init_data = client->dev.platform_data; - if (!init_data) return -EIO; @@ -502,21 +502,12 @@ int tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) /* Register the regulators */ rdev = regulator_register(&tps->desc[i], &client->dev, - init_data, tps); + init_data, tps); if (IS_ERR(rdev)) { dev_err(&client->dev, "failed to register %s\n", id->name); - - /* Unregister */ - while (i) - regulator_unregister(tps->rdev[--i]); - - tps->client = NULL; - - /* clear the client data in i2c */ - i2c_set_clientdata(client, NULL); - kfree(tps); - return PTR_ERR(rdev); + error = PTR_ERR(rdev); + goto fail; } /* Save regulator for cleanup */ @@ -526,6 +517,13 @@ int tps_65023_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, tps); return 0; + + fail: + while (--i >= 0) + regulator_unregister(tps->rdev[i]); + + kfree(tps); + return error; } /** @@ -539,13 +537,12 @@ static int __devexit tps_65023_remove(struct i2c_client *client) struct tps_pmic *tps = i2c_get_clientdata(client); int i; + /* clear the client data in i2c */ + i2c_set_clientdata(client, NULL); + for (i = 0; i < TPS65023_NUM_REGULATOR; i++) regulator_unregister(tps->rdev[i]); - tps->client = NULL; - - /* clear the client data in i2c */ - i2c_set_clientdata(client, NULL); kfree(tps); return 0; |