]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
misc: nct: error handling for no regulator
authorBitan Biswas <bbiswas@nvidia.com>
Fri, 24 May 2013 14:49:03 +0000 (20:19 +0530)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:28:14 +0000 (13:28 -0700)
bug 1291015

Change-Id: I7abfa27fddf42e7f6f105d35c055eb31d4874a59
Signed-off-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-on: http://git-master/r/232623
(cherry picked from commit e960eaf4a5c9c13054f474bae247a88185626d56)
Reviewed-on: http://git-master/r/239782
(cherry picked from commit ce0df13f7caeb79ff32dd27dd32bda4e17d162f0)
Reviewed-on: http://git-master/r/247088
Reviewed-by: Automatic_Commit_Validation_User
drivers/misc/nct1008.c

index 446883b49b0d967e0548eb97a1ae92775eb365b3..005eaca32b162baf6b6adbfb2f496cb6b0cc9d4a 100644 (file)
@@ -1111,6 +1111,11 @@ static int nct1008_probe(struct i2c_client *client,
        mutex_init(&data->mutex);
 
        nct1008_power_control(data, true);
+       if (!data->nct_reg) {
+               /* power up failure */
+               err = -EIO;
+               goto cleanup;
+       }
        /* extended range recommended steps 1 through 4 taken care
         * in nct1008_configure_sensor function */
        err = nct1008_configure_sensor(data);   /* sensor is in standby */
@@ -1195,6 +1200,7 @@ static int nct1008_probe(struct i2c_client *client,
 error:
        dev_err(&client->dev, "\n exit %s, err=%d ", __func__, err);
        nct1008_power_control(data, false);
+cleanup:
        mutex_destroy(&data->mutex);
        if (data->nct_reg)
                regulator_put(data->nct_reg);