summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/nct6775.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-05-09 19:40:01 +0200
committerGuenter Roeck <linux@roeck-us.net>2013-05-12 07:55:07 +0200
commit169c05cd54473ba4cc37bf4d22e7631395d14f68 (patch)
tree573e7ede23e153a6fabe25f4e98b325371296435 /drivers/hwmon/nct6775.c
parenthwmon: (iio_hwmon) Fix missing iio_channel_release_all call if devm_kzalloc fail (diff)
downloadlinux-169c05cd54473ba4cc37bf4d22e7631395d14f68.tar.xz
linux-169c05cd54473ba4cc37bf4d22e7631395d14f68.zip
hwmon: (nct6775) Do not create non-existing attributes
Overtemperature and hysteresis registers only exist for primary temperature registers, not for alternates, so do not assign those registers when initializing alternates. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/nct6775.c')
-rw-r--r--drivers/hwmon/nct6775.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/nct6775.c b/drivers/hwmon/nct6775.c
index f43f5e571db9..04638aee9039 100644
--- a/drivers/hwmon/nct6775.c
+++ b/drivers/hwmon/nct6775.c
@@ -3705,8 +3705,10 @@ static int nct6775_probe(struct platform_device *pdev)
data->have_temp |= 1 << i;
data->have_temp_fixed |= 1 << i;
data->reg_temp[0][i] = reg_temp_alternate[i];
- data->reg_temp[1][i] = reg_temp_over[i];
- data->reg_temp[2][i] = reg_temp_hyst[i];
+ if (i < num_reg_temp) {
+ data->reg_temp[1][i] = reg_temp_over[i];
+ data->reg_temp[2][i] = reg_temp_hyst[i];
+ }
data->temp_src[i] = i + 1;
continue;
}