diff options
author | Jonas Aaberg <jonas.aberg@stericsson.com> | 2012-02-14 07:46:59 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@linaro.org> | 2012-02-15 09:35:34 +0100 |
commit | d7cd9bc76222b86925db2d0ba76a3ffa34219de0 (patch) | |
tree | 36679bd31cfea984f684ea16f8fb7c7a234e8fe0 | |
parent | b4373ccf679309143d26ac3d148a81dc7c405fa7 (diff) |
misc: bh1780gli: Fix some obvious short commings
Unbalanced regulator handling on error during probe
and msleep on times less than 10 ms.
ST-Ericsson Linux next: -
ST-Ericsson ID: 370799
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Ic1080bf38a2f1e1922ec015b305b5a2de3b30f0e
Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com>
-rw-r--r-- | drivers/misc/bh1780gli.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/misc/bh1780gli.c b/drivers/misc/bh1780gli.c index ec303edd94a..3dbbf52a126 100644 --- a/drivers/misc/bh1780gli.c +++ b/drivers/misc/bh1780gli.c @@ -146,7 +146,7 @@ static ssize_t bh1780_store_power_state(struct device *dev, if (val == BH1780_POFF) regulator_disable(ddata->regulator); - msleep(BH1780_PON_DELAY); + mdelay(BH1780_PON_DELAY); ddata->power_state = val; mutex_unlock(&ddata->lock); @@ -202,7 +202,7 @@ static int __devinit bh1780_probe(struct i2c_client *client, ret = bh1780_read(ddata, BH1780_REG_PARTID, "PART ID"); if (ret < 0) { dev_err(&client->dev, "failed to read part ID\n"); - goto put_regulator; + goto disable_regulator; } #ifdef CONFIG_HAS_EARLYSUSPEND ddata->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; @@ -220,13 +220,15 @@ static int __devinit bh1780_probe(struct i2c_client *client, mutex_init(&ddata->lock); ret = sysfs_create_group(&client->dev.kobj, &bh1780_attr_group); - if (ret) + if (ret) { + dev_err(&client->dev, "failed to create sysfs group\n"); goto put_regulator; + } return 0; - -put_regulator: +disable_regulator: regulator_disable(ddata->regulator); +put_regulator: regulator_put(ddata->regulator); free_ddata: kfree(ddata); |