atheros: add working patches/config for 2.6.30
[openwrt.git] / target / linux / ps3 / patches-2.6.28 / 0001-powerpc-ps3-Fix-memory-leak-in-device-init.patch
1 From d4ad304841a9790d4fa35e51d6aa9baeba631559 Mon Sep 17 00:00:00 2001
2 From: Masakazu Mokuno <mokuno@sm.sony.co.jp>
3 Date: Thu, 30 Oct 2008 08:17:18 +0000
4 Subject: [PATCH] powerpc/ps3: Fix memory leak in device init
5
6 Free dynamically allocated device data structures when device registration
7 fails. This fixes memory leakage when the registration fails.
8
9 Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
10 Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
11 Signed-off-by: Paul Mackerras <paulus@samba.org>
12 ---
13 arch/powerpc/platforms/ps3/device-init.c | 29 ++++++++++++++++++++++++-----
14 1 files changed, 24 insertions(+), 5 deletions(-)
15
16 diff --git a/arch/powerpc/platforms/ps3/device-init.c b/arch/powerpc/platforms/ps3/device-init.c
17 index ffdd8e9..43816da 100644
18 --- a/arch/powerpc/platforms/ps3/device-init.c
19 +++ b/arch/powerpc/platforms/ps3/device-init.c
20 @@ -314,11 +314,17 @@ static int __init ps3_setup_vuart_device(enum ps3_match_id match_id,
21
22 result = ps3_system_bus_device_register(&p->dev);
23
24 - if (result)
25 + if (result) {
26 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
27 __func__, __LINE__);
28 -
29 + goto fail_device_register;
30 + }
31 pr_debug(" <- %s:%d\n", __func__, __LINE__);
32 + return 0;
33 +
34 +fail_device_register:
35 + kfree(p);
36 + pr_debug(" <- %s:%d fail\n", __func__, __LINE__);
37 return result;
38 }
39
40 @@ -463,11 +469,17 @@ static int __init ps3_register_sound_devices(void)
41
42 result = ps3_system_bus_device_register(&p->dev);
43
44 - if (result)
45 + if (result) {
46 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
47 __func__, __LINE__);
48 -
49 + goto fail_device_register;
50 + }
51 pr_debug(" <- %s:%d\n", __func__, __LINE__);
52 + return 0;
53 +
54 +fail_device_register:
55 + kfree(p);
56 + pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
57 return result;
58 }
59
60 @@ -491,11 +503,18 @@ static int __init ps3_register_graphics_devices(void)
61
62 result = ps3_system_bus_device_register(&p->dev);
63
64 - if (result)
65 + if (result) {
66 pr_debug("%s:%d ps3_system_bus_device_register failed\n",
67 __func__, __LINE__);
68 + goto fail_device_register;
69 + }
70
71 pr_debug(" <- %s:%d\n", __func__, __LINE__);
72 + return 0;
73 +
74 +fail_device_register:
75 + kfree(p);
76 + pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
77 return result;
78 }
79
80 --
81 1.6.0.4
82
This page took 0.044682 seconds and 5 git commands to generate.