diff options
| -rw-r--r-- | drivers/hwmon/tmp401.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c index ccd993880d74..f2182ee80830 100644 --- a/drivers/hwmon/tmp401.c +++ b/drivers/hwmon/tmp401.c | |||
| @@ -615,10 +615,10 @@ static const struct attribute_group tmp432_group = { | |||
| 615 | * Begin non sysfs callback code (aka Real code) | 615 | * Begin non sysfs callback code (aka Real code) |
| 616 | */ | 616 | */ |
| 617 | 617 | ||
| 618 | static void tmp401_init_client(struct tmp401_data *data, | 618 | static int tmp401_init_client(struct tmp401_data *data, |
| 619 | struct i2c_client *client) | 619 | struct i2c_client *client) |
| 620 | { | 620 | { |
| 621 | int config, config_orig; | 621 | int config, config_orig, status = 0; |
| 622 | 622 | ||
| 623 | /* Set the conversion rate to 2 Hz */ | 623 | /* Set the conversion rate to 2 Hz */ |
| 624 | i2c_smbus_write_byte_data(client, TMP401_CONVERSION_RATE_WRITE, 5); | 624 | i2c_smbus_write_byte_data(client, TMP401_CONVERSION_RATE_WRITE, 5); |
| @@ -626,16 +626,18 @@ static void tmp401_init_client(struct tmp401_data *data, | |||
| 626 | 626 | ||
| 627 | /* Start conversions (disable shutdown if necessary) */ | 627 | /* Start conversions (disable shutdown if necessary) */ |
| 628 | config = i2c_smbus_read_byte_data(client, TMP401_CONFIG_READ); | 628 | config = i2c_smbus_read_byte_data(client, TMP401_CONFIG_READ); |
| 629 | if (config < 0) { | 629 | if (config < 0) |
| 630 | dev_warn(&client->dev, "Initialization failed!\n"); | 630 | return config; |
| 631 | return; | ||
| 632 | } | ||
| 633 | 631 | ||
| 634 | config_orig = config; | 632 | config_orig = config; |
| 635 | config &= ~TMP401_CONFIG_SHUTDOWN; | 633 | config &= ~TMP401_CONFIG_SHUTDOWN; |
| 636 | 634 | ||
| 637 | if (config != config_orig) | 635 | if (config != config_orig) |
| 638 | i2c_smbus_write_byte_data(client, TMP401_CONFIG_WRITE, config); | 636 | status = i2c_smbus_write_byte_data(client, |
| 637 | TMP401_CONFIG_WRITE, | ||
| 638 | config); | ||
| 639 | |||
| 640 | return status; | ||
| 639 | } | 641 | } |
| 640 | 642 | ||
| 641 | static int tmp401_detect(struct i2c_client *client, | 643 | static int tmp401_detect(struct i2c_client *client, |
| @@ -718,7 +720,7 @@ static int tmp401_probe(struct i2c_client *client, | |||
| 718 | struct device *dev = &client->dev; | 720 | struct device *dev = &client->dev; |
| 719 | struct device *hwmon_dev; | 721 | struct device *hwmon_dev; |
| 720 | struct tmp401_data *data; | 722 | struct tmp401_data *data; |
| 721 | int groups = 0; | 723 | int groups = 0, status; |
| 722 | 724 | ||
| 723 | data = devm_kzalloc(dev, sizeof(struct tmp401_data), GFP_KERNEL); | 725 | data = devm_kzalloc(dev, sizeof(struct tmp401_data), GFP_KERNEL); |
| 724 | if (!data) | 726 | if (!data) |
| @@ -729,7 +731,9 @@ static int tmp401_probe(struct i2c_client *client, | |||
| 729 | data->kind = id->driver_data; | 731 | data->kind = id->driver_data; |
| 730 | 732 | ||
| 731 | /* Initialize the TMP401 chip */ | 733 | /* Initialize the TMP401 chip */ |
| 732 | tmp401_init_client(data, client); | 734 | status = tmp401_init_client(data, client); |
| 735 | if (status < 0) | ||
| 736 | return status; | ||
| 733 | 737 | ||
| 734 | /* Register sysfs hooks */ | 738 | /* Register sysfs hooks */ |
| 735 | data->groups[groups++] = &tmp401_group; | 739 | data->groups[groups++] = &tmp401_group; |
