diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-09-24 15:14:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:17 -0400 |
commit | 0501a3816e5b778830fc2157a6d6bb11a965fc2c (patch) | |
tree | 9424b8b523ea1a9c1522babe2becd77b8c614494 /drivers/hwmon/lm85.c | |
parent | c18beb5b92b090cb424718a4f1771b1a9fad56de (diff) |
hwmon: Fix unchecked return status, batch 2
hwmon: Fix unchecked return status, batch 2
Fix up some hwmon drivers so that they no longer ignore return status
from device_create_file().
Signed-off-by: Mark M. Hoffman <mhoffman@lightlink.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/lm85.c')
-rw-r--r-- | drivers/hwmon/lm85.c | 173 |
1 files changed, 102 insertions, 71 deletions
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 342e9663119d..2c3293cf69d1 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -1025,6 +1025,89 @@ static int lm85_attach_adapter(struct i2c_adapter *adapter) | |||
1025 | return i2c_probe(adapter, &addr_data, lm85_detect); | 1025 | return i2c_probe(adapter, &addr_data, lm85_detect); |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | static struct attribute *lm85_attributes[] = { | ||
1029 | &dev_attr_fan1_input.attr, | ||
1030 | &dev_attr_fan2_input.attr, | ||
1031 | &dev_attr_fan3_input.attr, | ||
1032 | &dev_attr_fan4_input.attr, | ||
1033 | &dev_attr_fan1_min.attr, | ||
1034 | &dev_attr_fan2_min.attr, | ||
1035 | &dev_attr_fan3_min.attr, | ||
1036 | &dev_attr_fan4_min.attr, | ||
1037 | &dev_attr_pwm1.attr, | ||
1038 | &dev_attr_pwm2.attr, | ||
1039 | &dev_attr_pwm3.attr, | ||
1040 | &dev_attr_pwm1_enable.attr, | ||
1041 | &dev_attr_pwm2_enable.attr, | ||
1042 | &dev_attr_pwm3_enable.attr, | ||
1043 | &dev_attr_in0_input.attr, | ||
1044 | &dev_attr_in1_input.attr, | ||
1045 | &dev_attr_in2_input.attr, | ||
1046 | &dev_attr_in3_input.attr, | ||
1047 | &dev_attr_in0_min.attr, | ||
1048 | &dev_attr_in1_min.attr, | ||
1049 | &dev_attr_in2_min.attr, | ||
1050 | &dev_attr_in3_min.attr, | ||
1051 | &dev_attr_in0_max.attr, | ||
1052 | &dev_attr_in1_max.attr, | ||
1053 | &dev_attr_in2_max.attr, | ||
1054 | &dev_attr_in3_max.attr, | ||
1055 | &dev_attr_temp1_input.attr, | ||
1056 | &dev_attr_temp2_input.attr, | ||
1057 | &dev_attr_temp3_input.attr, | ||
1058 | &dev_attr_temp1_min.attr, | ||
1059 | &dev_attr_temp2_min.attr, | ||
1060 | &dev_attr_temp3_min.attr, | ||
1061 | &dev_attr_temp1_max.attr, | ||
1062 | &dev_attr_temp2_max.attr, | ||
1063 | &dev_attr_temp3_max.attr, | ||
1064 | &dev_attr_vrm.attr, | ||
1065 | &dev_attr_cpu0_vid.attr, | ||
1066 | &dev_attr_alarms.attr, | ||
1067 | &dev_attr_pwm1_auto_channels.attr, | ||
1068 | &dev_attr_pwm2_auto_channels.attr, | ||
1069 | &dev_attr_pwm3_auto_channels.attr, | ||
1070 | &dev_attr_pwm1_auto_pwm_min.attr, | ||
1071 | &dev_attr_pwm2_auto_pwm_min.attr, | ||
1072 | &dev_attr_pwm3_auto_pwm_min.attr, | ||
1073 | &dev_attr_pwm1_auto_pwm_minctl.attr, | ||
1074 | &dev_attr_pwm2_auto_pwm_minctl.attr, | ||
1075 | &dev_attr_pwm3_auto_pwm_minctl.attr, | ||
1076 | &dev_attr_pwm1_auto_pwm_freq.attr, | ||
1077 | &dev_attr_pwm2_auto_pwm_freq.attr, | ||
1078 | &dev_attr_pwm3_auto_pwm_freq.attr, | ||
1079 | &dev_attr_temp1_auto_temp_off.attr, | ||
1080 | &dev_attr_temp2_auto_temp_off.attr, | ||
1081 | &dev_attr_temp3_auto_temp_off.attr, | ||
1082 | &dev_attr_temp1_auto_temp_min.attr, | ||
1083 | &dev_attr_temp2_auto_temp_min.attr, | ||
1084 | &dev_attr_temp3_auto_temp_min.attr, | ||
1085 | &dev_attr_temp1_auto_temp_max.attr, | ||
1086 | &dev_attr_temp2_auto_temp_max.attr, | ||
1087 | &dev_attr_temp3_auto_temp_max.attr, | ||
1088 | &dev_attr_temp1_auto_temp_crit.attr, | ||
1089 | &dev_attr_temp2_auto_temp_crit.attr, | ||
1090 | &dev_attr_temp3_auto_temp_crit.attr, | ||
1091 | |||
1092 | NULL | ||
1093 | }; | ||
1094 | |||
1095 | static const struct attribute_group lm85_group = { | ||
1096 | .attrs = lm85_attributes, | ||
1097 | }; | ||
1098 | |||
1099 | static struct attribute *lm85_attributes_opt[] = { | ||
1100 | &dev_attr_in4_input.attr, | ||
1101 | &dev_attr_in4_min.attr, | ||
1102 | &dev_attr_in4_max.attr, | ||
1103 | |||
1104 | NULL | ||
1105 | }; | ||
1106 | |||
1107 | static const struct attribute_group lm85_group_opt = { | ||
1108 | .attrs = lm85_attributes_opt, | ||
1109 | }; | ||
1110 | |||
1028 | static int lm85_detect(struct i2c_adapter *adapter, int address, | 1111 | static int lm85_detect(struct i2c_adapter *adapter, int address, |
1029 | int kind) | 1112 | int kind) |
1030 | { | 1113 | { |
@@ -1163,87 +1246,33 @@ static int lm85_detect(struct i2c_adapter *adapter, int address, | |||
1163 | lm85_init_client(new_client); | 1246 | lm85_init_client(new_client); |
1164 | 1247 | ||
1165 | /* Register sysfs hooks */ | 1248 | /* Register sysfs hooks */ |
1166 | data->class_dev = hwmon_device_register(&new_client->dev); | 1249 | if ((err = sysfs_create_group(&new_client->dev.kobj, &lm85_group))) |
1167 | if (IS_ERR(data->class_dev)) { | ||
1168 | err = PTR_ERR(data->class_dev); | ||
1169 | goto ERROR2; | 1250 | goto ERROR2; |
1170 | } | ||
1171 | |||
1172 | device_create_file(&new_client->dev, &dev_attr_fan1_input); | ||
1173 | device_create_file(&new_client->dev, &dev_attr_fan2_input); | ||
1174 | device_create_file(&new_client->dev, &dev_attr_fan3_input); | ||
1175 | device_create_file(&new_client->dev, &dev_attr_fan4_input); | ||
1176 | device_create_file(&new_client->dev, &dev_attr_fan1_min); | ||
1177 | device_create_file(&new_client->dev, &dev_attr_fan2_min); | ||
1178 | device_create_file(&new_client->dev, &dev_attr_fan3_min); | ||
1179 | device_create_file(&new_client->dev, &dev_attr_fan4_min); | ||
1180 | device_create_file(&new_client->dev, &dev_attr_pwm1); | ||
1181 | device_create_file(&new_client->dev, &dev_attr_pwm2); | ||
1182 | device_create_file(&new_client->dev, &dev_attr_pwm3); | ||
1183 | device_create_file(&new_client->dev, &dev_attr_pwm1_enable); | ||
1184 | device_create_file(&new_client->dev, &dev_attr_pwm2_enable); | ||
1185 | device_create_file(&new_client->dev, &dev_attr_pwm3_enable); | ||
1186 | device_create_file(&new_client->dev, &dev_attr_in0_input); | ||
1187 | device_create_file(&new_client->dev, &dev_attr_in1_input); | ||
1188 | device_create_file(&new_client->dev, &dev_attr_in2_input); | ||
1189 | device_create_file(&new_client->dev, &dev_attr_in3_input); | ||
1190 | device_create_file(&new_client->dev, &dev_attr_in0_min); | ||
1191 | device_create_file(&new_client->dev, &dev_attr_in1_min); | ||
1192 | device_create_file(&new_client->dev, &dev_attr_in2_min); | ||
1193 | device_create_file(&new_client->dev, &dev_attr_in3_min); | ||
1194 | device_create_file(&new_client->dev, &dev_attr_in0_max); | ||
1195 | device_create_file(&new_client->dev, &dev_attr_in1_max); | ||
1196 | device_create_file(&new_client->dev, &dev_attr_in2_max); | ||
1197 | device_create_file(&new_client->dev, &dev_attr_in3_max); | ||
1198 | device_create_file(&new_client->dev, &dev_attr_temp1_input); | ||
1199 | device_create_file(&new_client->dev, &dev_attr_temp2_input); | ||
1200 | device_create_file(&new_client->dev, &dev_attr_temp3_input); | ||
1201 | device_create_file(&new_client->dev, &dev_attr_temp1_min); | ||
1202 | device_create_file(&new_client->dev, &dev_attr_temp2_min); | ||
1203 | device_create_file(&new_client->dev, &dev_attr_temp3_min); | ||
1204 | device_create_file(&new_client->dev, &dev_attr_temp1_max); | ||
1205 | device_create_file(&new_client->dev, &dev_attr_temp2_max); | ||
1206 | device_create_file(&new_client->dev, &dev_attr_temp3_max); | ||
1207 | device_create_file(&new_client->dev, &dev_attr_vrm); | ||
1208 | device_create_file(&new_client->dev, &dev_attr_cpu0_vid); | ||
1209 | device_create_file(&new_client->dev, &dev_attr_alarms); | ||
1210 | device_create_file(&new_client->dev, &dev_attr_pwm1_auto_channels); | ||
1211 | device_create_file(&new_client->dev, &dev_attr_pwm2_auto_channels); | ||
1212 | device_create_file(&new_client->dev, &dev_attr_pwm3_auto_channels); | ||
1213 | device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_min); | ||
1214 | device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_min); | ||
1215 | device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_min); | ||
1216 | device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_minctl); | ||
1217 | device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_minctl); | ||
1218 | device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_minctl); | ||
1219 | device_create_file(&new_client->dev, &dev_attr_pwm1_auto_pwm_freq); | ||
1220 | device_create_file(&new_client->dev, &dev_attr_pwm2_auto_pwm_freq); | ||
1221 | device_create_file(&new_client->dev, &dev_attr_pwm3_auto_pwm_freq); | ||
1222 | device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_off); | ||
1223 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_off); | ||
1224 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_off); | ||
1225 | device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_min); | ||
1226 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_min); | ||
1227 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_min); | ||
1228 | device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_max); | ||
1229 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_max); | ||
1230 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_max); | ||
1231 | device_create_file(&new_client->dev, &dev_attr_temp1_auto_temp_crit); | ||
1232 | device_create_file(&new_client->dev, &dev_attr_temp2_auto_temp_crit); | ||
1233 | device_create_file(&new_client->dev, &dev_attr_temp3_auto_temp_crit); | ||
1234 | 1251 | ||
1235 | /* The ADT7463 has an optional VRM 10 mode where pin 21 is used | 1252 | /* The ADT7463 has an optional VRM 10 mode where pin 21 is used |
1236 | as a sixth digital VID input rather than an analog input. */ | 1253 | as a sixth digital VID input rather than an analog input. */ |
1237 | data->vid = lm85_read_value(new_client, LM85_REG_VID); | 1254 | data->vid = lm85_read_value(new_client, LM85_REG_VID); |
1238 | if (!(kind == adt7463 && (data->vid & 0x80))) { | 1255 | if (!(kind == adt7463 && (data->vid & 0x80))) |
1239 | device_create_file(&new_client->dev, &dev_attr_in4_input); | 1256 | if ((err = device_create_file(&new_client->dev, |
1240 | device_create_file(&new_client->dev, &dev_attr_in4_min); | 1257 | &dev_attr_in4_input)) |
1241 | device_create_file(&new_client->dev, &dev_attr_in4_max); | 1258 | || (err = device_create_file(&new_client->dev, |
1259 | &dev_attr_in4_min)) | ||
1260 | || (err = device_create_file(&new_client->dev, | ||
1261 | &dev_attr_in4_max))) | ||
1262 | goto ERROR3; | ||
1263 | |||
1264 | data->class_dev = hwmon_device_register(&new_client->dev); | ||
1265 | if (IS_ERR(data->class_dev)) { | ||
1266 | err = PTR_ERR(data->class_dev); | ||
1267 | goto ERROR3; | ||
1242 | } | 1268 | } |
1243 | 1269 | ||
1244 | return 0; | 1270 | return 0; |
1245 | 1271 | ||
1246 | /* Error out and cleanup code */ | 1272 | /* Error out and cleanup code */ |
1273 | ERROR3: | ||
1274 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group); | ||
1275 | sysfs_remove_group(&new_client->dev.kobj, &lm85_group_opt); | ||
1247 | ERROR2: | 1276 | ERROR2: |
1248 | i2c_detach_client(new_client); | 1277 | i2c_detach_client(new_client); |
1249 | ERROR1: | 1278 | ERROR1: |
@@ -1256,6 +1285,8 @@ static int lm85_detach_client(struct i2c_client *client) | |||
1256 | { | 1285 | { |
1257 | struct lm85_data *data = i2c_get_clientdata(client); | 1286 | struct lm85_data *data = i2c_get_clientdata(client); |
1258 | hwmon_device_unregister(data->class_dev); | 1287 | hwmon_device_unregister(data->class_dev); |
1288 | sysfs_remove_group(&client->dev.kobj, &lm85_group); | ||
1289 | sysfs_remove_group(&client->dev.kobj, &lm85_group_opt); | ||
1259 | i2c_detach_client(client); | 1290 | i2c_detach_client(client); |
1260 | kfree(data); | 1291 | kfree(data); |
1261 | return 0; | 1292 | return 0; |