Skip to contentSkip to conversation

hwmon: (ads1015) Fix file leak in probe function

PATCH In review Guenter Roeck 2 participants 2 messages Feb 22, 2012 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (ads1015) Fix file leak in probe function

An error while creating sysfs attribute files in the driver's probe function results in an error abort, but already created files are not removed. This patch fixes the problem.

---
 drivers/hwmon/ads1015.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/ads1015.c +1 -1
index eedca3c..1a1f058 100644
@@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
 			continue;
 		err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
 		if (err)
-			goto exit_free;
+			goto exit_remove;
 	}
 
 	data->hwmon_dev = hwmon_device_register(&client->dev);
Signature · 7 lines
1.7.3.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Guenter Roeck

An error while creating sysfs attribute files in the driver's probe function results in an error abort, but already created files are not removed. This patch fixes the problem.

---
 drivers/hwmon/ads1015.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/ads1015.c +0 -0
index eedca3c..1a1f058 100644

drivers/hwmon/ads1015.c static int ads1015_probe(struct i2c_client *client, · line 277

Quoted 8 lines
drivers/hwmon/ads1015.c +1 -1
@@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
 			continue;
 		err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
 		if (err)
-			goto exit_free;
+			goto exit_remove;
 	}
 
 	data->hwmon_dev = hwmon_device_register(&client->dev);

Good catch.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors