diff options
author | Mark M. Hoffman <mhoffman@lightlink.com> | 2006-09-24 14:59:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-28 18:31:17 -0400 |
commit | c1685f61b0a3110b701d09b84a9f9a3d4e9ef2e2 (patch) | |
tree | 8c7f4791ae7c31390ba127d4e0c0d766775819f4 /drivers/hwmon/smsc47b397.c | |
parent | a1fdcb96ee33ba75318476a2a4691147c9f2ad90 (diff) |
hwmon: Fix unchecked return status, batch 1
hwmon: Fix unchecked return status, batch 1
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/smsc47b397.c')
-rw-r--r-- | drivers/hwmon/smsc47b397.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/drivers/hwmon/smsc47b397.c b/drivers/hwmon/smsc47b397.c index a85869393bab..72b0e2d8650c 100644 --- a/drivers/hwmon/smsc47b397.c +++ b/drivers/hwmon/smsc47b397.c | |||
@@ -176,9 +176,6 @@ sysfs_temp(2); | |||
176 | sysfs_temp(3); | 176 | sysfs_temp(3); |
177 | sysfs_temp(4); | 177 | sysfs_temp(4); |
178 | 178 | ||
179 | #define device_create_file_temp(client, num) \ | ||
180 | device_create_file(&client->dev, &dev_attr_temp##num##_input) | ||
181 | |||
182 | /* FAN: 1 RPM/bit | 179 | /* FAN: 1 RPM/bit |
183 | REG: count of 90kHz pulses / revolution */ | 180 | REG: count of 90kHz pulses / revolution */ |
184 | static int fan_from_reg(u16 reg) | 181 | static int fan_from_reg(u16 reg) |
@@ -205,8 +202,22 @@ sysfs_fan(2); | |||
205 | sysfs_fan(3); | 202 | sysfs_fan(3); |
206 | sysfs_fan(4); | 203 | sysfs_fan(4); |
207 | 204 | ||
208 | #define device_create_file_fan(client, num) \ | 205 | static struct attribute *smsc47b397_attributes[] = { |
209 | device_create_file(&client->dev, &dev_attr_fan##num##_input) | 206 | &dev_attr_temp1_input.attr, |
207 | &dev_attr_temp2_input.attr, | ||
208 | &dev_attr_temp3_input.attr, | ||
209 | &dev_attr_temp4_input.attr, | ||
210 | &dev_attr_fan1_input.attr, | ||
211 | &dev_attr_fan2_input.attr, | ||
212 | &dev_attr_fan3_input.attr, | ||
213 | &dev_attr_fan4_input.attr, | ||
214 | |||
215 | NULL | ||
216 | }; | ||
217 | |||
218 | static const struct attribute_group smsc47b397_group = { | ||
219 | .attrs = smsc47b397_attributes, | ||
220 | }; | ||
210 | 221 | ||
211 | static int smsc47b397_detach_client(struct i2c_client *client) | 222 | static int smsc47b397_detach_client(struct i2c_client *client) |
212 | { | 223 | { |
@@ -214,6 +225,7 @@ static int smsc47b397_detach_client(struct i2c_client *client) | |||
214 | int err; | 225 | int err; |
215 | 226 | ||
216 | hwmon_device_unregister(data->class_dev); | 227 | hwmon_device_unregister(data->class_dev); |
228 | sysfs_remove_group(&client->dev.kobj, &smsc47b397_group); | ||
217 | 229 | ||
218 | if ((err = i2c_detach_client(client))) | 230 | if ((err = i2c_detach_client(client))) |
219 | return err; | 231 | return err; |
@@ -268,24 +280,19 @@ static int smsc47b397_detect(struct i2c_adapter *adapter) | |||
268 | if ((err = i2c_attach_client(new_client))) | 280 | if ((err = i2c_attach_client(new_client))) |
269 | goto error_free; | 281 | goto error_free; |
270 | 282 | ||
283 | if ((err = sysfs_create_group(&new_client->dev.kobj, &smsc47b397_group))) | ||
284 | goto error_detach; | ||
285 | |||
271 | data->class_dev = hwmon_device_register(&new_client->dev); | 286 | data->class_dev = hwmon_device_register(&new_client->dev); |
272 | if (IS_ERR(data->class_dev)) { | 287 | if (IS_ERR(data->class_dev)) { |
273 | err = PTR_ERR(data->class_dev); | 288 | err = PTR_ERR(data->class_dev); |
274 | goto error_detach; | 289 | goto error_remove; |
275 | } | 290 | } |
276 | 291 | ||
277 | device_create_file_temp(new_client, 1); | ||
278 | device_create_file_temp(new_client, 2); | ||
279 | device_create_file_temp(new_client, 3); | ||
280 | device_create_file_temp(new_client, 4); | ||
281 | |||
282 | device_create_file_fan(new_client, 1); | ||
283 | device_create_file_fan(new_client, 2); | ||
284 | device_create_file_fan(new_client, 3); | ||
285 | device_create_file_fan(new_client, 4); | ||
286 | |||
287 | return 0; | 292 | return 0; |
288 | 293 | ||
294 | error_remove: | ||
295 | sysfs_remove_group(&new_client->dev.kobj, &smsc47b397_group); | ||
289 | error_detach: | 296 | error_detach: |
290 | i2c_detach_client(new_client); | 297 | i2c_detach_client(new_client); |
291 | error_free: | 298 | error_free: |