aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorHans de Goede <j.w.r.degoede@hhs.nl>2007-02-14 15:15:05 -0500
committerJean Delvare <khali@arrakis.delvare>2007-02-14 15:15:05 -0500
commitbc8f0a26855d8fac68040d462ec3cc13884e98e5 (patch)
treeb7590e94554022292c32931f68a583ddae525cc6 /drivers/hwmon
parentcae2caae78258d623c7b687029a19fa6b33c76f4 (diff)
hwmon/abituguru: Fix unchecked return status
Fix an unused return value warning for the abituguru driver. Also make sure the sysfs files are created before we register with the hwmon class, and delete the sysfs files on driver removal. Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/abituguru.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c
index b1dc63e4ac7b..bede4d990ea6 100644
--- a/drivers/hwmon/abituguru.c
+++ b/drivers/hwmon/abituguru.c
@@ -1267,30 +1267,42 @@ static int __devinit abituguru_probe(struct platform_device *pdev)
1267 printk(KERN_INFO ABIT_UGURU_NAME ": found Abit uGuru\n"); 1267 printk(KERN_INFO ABIT_UGURU_NAME ": found Abit uGuru\n");
1268 1268
1269 /* Register sysfs hooks */ 1269 /* Register sysfs hooks */
1270 data->class_dev = hwmon_device_register(&pdev->dev);
1271 if (IS_ERR(data->class_dev)) {
1272 res = PTR_ERR(data->class_dev);
1273 goto abituguru_probe_error;
1274 }
1275 for (i = 0; i < sysfs_attr_i; i++) 1270 for (i = 0; i < sysfs_attr_i; i++)
1276 device_create_file(&pdev->dev, &data->sysfs_attr[i].dev_attr); 1271 if (device_create_file(&pdev->dev,
1272 &data->sysfs_attr[i].dev_attr))
1273 goto abituguru_probe_error;
1277 for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) 1274 for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
1278 device_create_file(&pdev->dev, 1275 if (device_create_file(&pdev->dev,
1279 &abituguru_sysfs_attr[i].dev_attr); 1276 &abituguru_sysfs_attr[i].dev_attr))
1277 goto abituguru_probe_error;
1280 1278
1281 return 0; 1279 data->class_dev = hwmon_device_register(&pdev->dev);
1280 if (!IS_ERR(data->class_dev))
1281 return 0; /* success */
1282 1282
1283 res = PTR_ERR(data->class_dev);
1283abituguru_probe_error: 1284abituguru_probe_error:
1285 for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
1286 device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
1287 for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
1288 device_remove_file(&pdev->dev,
1289 &abituguru_sysfs_attr[i].dev_attr);
1284 kfree(data); 1290 kfree(data);
1285 return res; 1291 return res;
1286} 1292}
1287 1293
1288static int __devexit abituguru_remove(struct platform_device *pdev) 1294static int __devexit abituguru_remove(struct platform_device *pdev)
1289{ 1295{
1296 int i;
1290 struct abituguru_data *data = platform_get_drvdata(pdev); 1297 struct abituguru_data *data = platform_get_drvdata(pdev);
1291 1298
1292 platform_set_drvdata(pdev, NULL); 1299 platform_set_drvdata(pdev, NULL);
1293 hwmon_device_unregister(data->class_dev); 1300 hwmon_device_unregister(data->class_dev);
1301 for (i = 0; data->sysfs_attr[i].dev_attr.attr.name; i++)
1302 device_remove_file(&pdev->dev, &data->sysfs_attr[i].dev_attr);
1303 for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++)
1304 device_remove_file(&pdev->dev,
1305 &abituguru_sysfs_attr[i].dev_attr);
1294 kfree(data); 1306 kfree(data);
1295 1307
1296 return 0; 1308 return 0;