hwmon: (nct6775) Do not create non-existing attributes
authorGuenter Roeck <linux@roeck-us.net>
Thu, 9 May 2013 17:40:01 +0000 (10:40 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Sun, 12 May 2013 05:55:07 +0000 (22:55 -0700)
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>
drivers/hwmon/nct6775.c

index f43f5e571db97a9b178f76a88ef82e8414c9ff39..04638aee90398f44e73a620e3a3cffc9631b8d40 100644 (file)
@@ -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;
                }