From 1a3abbd0b9a16e40fd4718f99896c437a193c0a1 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 11 Sep 2013 09:49:48 +0530 Subject: hwmon: (emc2103) Fix return value kstrtol() returns appropriate error values. Use those instead of hardcoding. Silences several sparse messages of following type: "why not propagate 'result' from kstrtol() instead of (-22)?" Signed-off-by: Sachin Kamat Cc: Steve Glendinning Signed-off-by: Guenter Roeck --- drivers/hwmon/emc2103.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/hwmon/emc2103.c b/drivers/hwmon/emc2103.c index b0730562208..2c137b26acb 100644 --- a/drivers/hwmon/emc2103.c +++ b/drivers/hwmon/emc2103.c @@ -248,7 +248,7 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *da, int result = kstrtol(buf, 10, &val); if (result < 0) - return -EINVAL; + return result; val = DIV_ROUND_CLOSEST(val, 1000); if ((val < -63) || (val > 127)) @@ -272,7 +272,7 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *da, int result = kstrtol(buf, 10, &val); if (result < 0) - return -EINVAL; + return result; val = DIV_ROUND_CLOSEST(val, 1000); if ((val < -63) || (val > 127)) @@ -320,7 +320,7 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *da, int status = kstrtol(buf, 10, &new_div); if (status < 0) - return -EINVAL; + return status; if (new_div == old_div) /* No change */ return count; @@ -394,7 +394,7 @@ static ssize_t set_fan_target(struct device *dev, struct device_attribute *da, int result = kstrtol(buf, 10, &rpm_target); if (result < 0) - return -EINVAL; + return result; /* Datasheet states 16384 as maximum RPM target (table 3.2) */ if ((rpm_target < 0) || (rpm_target > 16384)) @@ -440,7 +440,7 @@ static ssize_t set_pwm_enable(struct device *dev, struct device_attribute *da, int result = kstrtol(buf, 10, &new_value); if (result < 0) - return -EINVAL; + return result; mutex_lock(&data->update_lock); switch (new_value) { -- cgit v1.2.3-70-g09d2 From 12ca0b569eac0bf8389b3eac74ba1d7e9f624ab8 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 11 Sep 2013 09:49:49 +0530 Subject: hwmon: (ibmaem) Fix return value Propagate appropriate error code obtained from ipmi_create_user() instead of hardcoding. Signed-off-by: Sachin Kamat Cc: Darrick J. Wong Acked-by: Darrick J. Wong Signed-off-by: Guenter Roeck --- drivers/hwmon/ibmaem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c index e2b56a2b756..632f1dc0fe1 100644 --- a/drivers/hwmon/ibmaem.c +++ b/drivers/hwmon/ibmaem.c @@ -292,7 +292,7 @@ static int aem_init_ipmi_data(struct aem_ipmi_data *data, int iface, dev_err(bmc, "Unable to register user with IPMI interface %d\n", data->interface); - return -EACCES; + return err; } return 0; -- cgit v1.2.3-70-g09d2 From 3499e5b2e14b792fe411302fea3b6fcc4ba40ef2 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 11 Sep 2013 09:49:50 +0530 Subject: hwmon: (amc6821) Fix return value Propagate return value obtained from i2c_smbus_read_byte_data() instead of hardcoding. Signed-off-by: Sachin Kamat Cc: T. Mertelj Signed-off-by: Guenter Roeck --- drivers/hwmon/amc6821.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index 4fe49d2bfe1..fcb18535fd5 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -364,7 +364,7 @@ static ssize_t set_pwm1_enable( if (config < 0) { dev_err(&client->dev, "Error reading configuration register, aborting.\n"); - return -EIO; + return config; } switch (val) { @@ -665,7 +665,7 @@ static ssize_t set_fan1_div( if (config < 0) { dev_err(&client->dev, "Error reading configuration register, aborting.\n"); - return -EIO; + return config; } mutex_lock(&data->update_lock); switch (val) { -- cgit v1.2.3-70-g09d2 From 17a52100b03864b5e58fb45ec6b42d4fd81c4808 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 11 Sep 2013 09:49:51 +0530 Subject: hwmon: (amc6821) Remove redundant break 'break' after return or goto has no effect. Remove it. Signed-off-by: Sachin Kamat Cc: T. Mertelj Signed-off-by: Guenter Roeck --- drivers/hwmon/amc6821.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers') diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c index fcb18535fd5..eea81729651 100644 --- a/drivers/hwmon/amc6821.c +++ b/drivers/hwmon/amc6821.c @@ -416,11 +416,9 @@ static ssize_t get_temp_auto_point_temp( case 1: return sprintf(buf, "%d\n", data->temp1_auto_point_temp[ix] * 1000); - break; case 2: return sprintf(buf, "%d\n", data->temp2_auto_point_temp[ix] * 1000); - break; default: dev_dbg(dev, "Unknown attr->nr (%d).\n", nr); return -EINVAL; @@ -513,7 +511,6 @@ static ssize_t set_temp_auto_point_temp( count = -EIO; } goto EXIT; - break; case 1: ptemp[1] = clamp_val(val / 1000, (ptemp[0] & 0x7C) + 4, 124); ptemp[1] &= 0x7C; -- cgit v1.2.3-70-g09d2 From 010a166a5202f6297e196624a0671c4815032e38 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 11 Sep 2013 09:49:52 +0530 Subject: hwmon: (tmp421) Fix return value Propagate return value obtained from i2c_smbus_read_byte_data() instead of hardcoding. Signed-off-by: Sachin Kamat Cc: Andre Prendel Signed-off-by: Guenter Roeck --- drivers/hwmon/tmp421.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/hwmon/tmp421.c b/drivers/hwmon/tmp421.c index 964c1d68827..ae26b06fa81 100644 --- a/drivers/hwmon/tmp421.c +++ b/drivers/hwmon/tmp421.c @@ -210,7 +210,7 @@ static int tmp421_init_client(struct i2c_client *client) if (config < 0) { dev_err(&client->dev, "Could not read configuration register (%d)\n", config); - return -ENODEV; + return config; } config_orig = config; -- cgit v1.2.3-70-g09d2 From 0b77f766f3ef9875e2bb0035c9b89b4f9469b78d Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Thu, 12 Sep 2013 15:46:39 +0900 Subject: hwmon: (k10temp) remove unnecessary pci_set_drvdata() The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han Acked-by: Clemens Ladisch Signed-off-by: Guenter Roeck --- drivers/hwmon/k10temp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers') diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index e633856370c..d65f3fd895d 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c @@ -202,7 +202,6 @@ static void k10temp_remove(struct pci_dev *pdev) &sensor_dev_attr_temp1_crit.dev_attr); device_remove_file(&pdev->dev, &sensor_dev_attr_temp1_crit_hyst.dev_attr); - pci_set_drvdata(pdev, NULL); } static DEFINE_PCI_DEVICE_TABLE(k10temp_id_table) = { -- cgit v1.2.3-70-g09d2