[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-ti33x-psp-3.2 / 3.2.9 / 0052-hwmon-ads1015-Fix-file-leak-in-probe-function.patch
1 From 4651f6ab6be87e326d7ed3820be6cedfca323e51 Mon Sep 17 00:00:00 2001
2 From: Guenter Roeck <guenter.roeck@ericsson.com>
3 Date: Wed, 22 Feb 2012 08:13:52 -0800
4 Subject: [PATCH 52/73] hwmon: (ads1015) Fix file leak in probe function
6 commit 363434b5dc352464ac7601547891e5fc9105f124 upstream.
8 An error while creating sysfs attribute files in the driver's probe function
9 results in an error abort, but already created files are not removed. This patch
10 fixes the problem.
12 Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
13 Cc: Dirk Eibach <eibach@gdsys.de>
14 Acked-by: Jean Delvare <khali@linux-fr.org>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 ---
17 drivers/hwmon/ads1015.c | 3 +--
18 1 files changed, 1 insertions(+), 2 deletions(-)
20 diff --git a/drivers/hwmon/ads1015.c b/drivers/hwmon/ads1015.c
21 index eedca3c..dd87ae9 100644
22 --- a/drivers/hwmon/ads1015.c
23 +++ b/drivers/hwmon/ads1015.c
24 @@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
25 continue;
26 err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
27 if (err)
28 - goto exit_free;
29 + goto exit_remove;
30 }
32 data->hwmon_dev = hwmon_device_register(&client->dev);
33 @@ -285,7 +285,6 @@ static int ads1015_probe(struct i2c_client *client,
34 exit_remove:
35 for (k = 0; k < ADS1015_CHANNELS; ++k)
36 device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
37 -exit_free:
38 kfree(data);
39 exit:
40 return err;
41 --
42 1.7.7.4