diff options
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.12/0035-hwmon-w83627ehf-Fix-memory-leak-in-probe-function.patch')
-rw-r--r-- | recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.12/0035-hwmon-w83627ehf-Fix-memory-leak-in-probe-function.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.12/0035-hwmon-w83627ehf-Fix-memory-leak-in-probe-function.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.12/0035-hwmon-w83627ehf-Fix-memory-leak-in-probe-function.patch new file mode 100644 index 00000000..0df8c385 --- /dev/null +++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.12/0035-hwmon-w83627ehf-Fix-memory-leak-in-probe-function.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 61fa0a2298850898c90ce67bb0b9b440c452820a Mon Sep 17 00:00:00 2001 | ||
2 | From: Guenter Roeck <linux@roeck-us.net> | ||
3 | Date: Mon, 12 Mar 2012 08:33:10 -0700 | ||
4 | Subject: [PATCH 35/42] hwmon: (w83627ehf) Fix memory leak in probe function | ||
5 | |||
6 | commit 32260d94408c553dca4ce54104edf79941a27536 upstream. | ||
7 | |||
8 | The driver probe function leaked memory if creating the cpu0_vid attribute file | ||
9 | failed. Fix by converting the driver to use devm_kzalloc. | ||
10 | |||
11 | Signed-off-by: Guenter Roeck <linux@roeck-us.net> | ||
12 | Acked-by: Jean Delvare <khali@linux-fr.org> | ||
13 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | ||
14 | --- | ||
15 | drivers/hwmon/w83627ehf.c | 7 +++---- | ||
16 | 1 file changed, 3 insertions(+), 4 deletions(-) | ||
17 | |||
18 | diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c | ||
19 | index 7a44a56..3ffa1fa 100644 | ||
20 | --- a/drivers/hwmon/w83627ehf.c | ||
21 | +++ b/drivers/hwmon/w83627ehf.c | ||
22 | @@ -2004,7 +2004,8 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | ||
23 | goto exit; | ||
24 | } | ||
25 | |||
26 | - data = kzalloc(sizeof(struct w83627ehf_data), GFP_KERNEL); | ||
27 | + data = devm_kzalloc(&pdev->dev, sizeof(struct w83627ehf_data), | ||
28 | + GFP_KERNEL); | ||
29 | if (!data) { | ||
30 | err = -ENOMEM; | ||
31 | goto exit_release; | ||
32 | @@ -2498,9 +2499,8 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) | ||
33 | |||
34 | exit_remove: | ||
35 | w83627ehf_device_remove_files(dev); | ||
36 | - kfree(data); | ||
37 | - platform_set_drvdata(pdev, NULL); | ||
38 | exit_release: | ||
39 | + platform_set_drvdata(pdev, NULL); | ||
40 | release_region(res->start, IOREGION_LENGTH); | ||
41 | exit: | ||
42 | return err; | ||
43 | @@ -2514,7 +2514,6 @@ static int __devexit w83627ehf_remove(struct platform_device *pdev) | ||
44 | w83627ehf_device_remove_files(&pdev->dev); | ||
45 | release_region(data->addr, IOREGION_LENGTH); | ||
46 | platform_set_drvdata(pdev, NULL); | ||
47 | - kfree(data); | ||
48 | |||
49 | return 0; | ||
50 | } | ||
51 | -- | ||
52 | 1.7.9.4 | ||
53 | |||