aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2012-12-17 19:02:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:20 -0500
commit942bfb3ed08b677e0a447096c501d6b0b49f44f9 (patch)
tree97856fa62b4042e6a55c2184c5aa4f4328533979 /drivers/rtc
parent0d7ecb8389a34f650f0d4ab23a56c94595a75ccf (diff)
drivers/rtc/rtc-test.c: avoid calling platform_device_put() twice
In case of error, test_init() needs to call platform_device_del() instead of platform_device_unregister(). Otherwise, we may call platform_device_put() twice. dpatch engine is used to auto generate this patch. (https://github.com/weiyj/dpatch) [akpm@linux-foundation.org: improve label naming] Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-test.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c
index 7e96254bd365..974b9ae252ab 100644
--- a/drivers/rtc/rtc-test.c
+++ b/drivers/rtc/rtc-test.c
@@ -152,24 +152,24 @@ static int __init test_init(void)
152 152
153 if ((test1 = platform_device_alloc("rtc-test", 1)) == NULL) { 153 if ((test1 = platform_device_alloc("rtc-test", 1)) == NULL) {
154 err = -ENOMEM; 154 err = -ENOMEM;
155 goto exit_free_test0; 155 goto exit_put_test0;
156 } 156 }
157 157
158 if ((err = platform_device_add(test0))) 158 if ((err = platform_device_add(test0)))
159 goto exit_free_test1; 159 goto exit_put_test1;
160 160
161 if ((err = platform_device_add(test1))) 161 if ((err = platform_device_add(test1)))
162 goto exit_device_unregister; 162 goto exit_del_test0;
163 163
164 return 0; 164 return 0;
165 165
166exit_device_unregister: 166exit_del_test0:
167 platform_device_unregister(test0); 167 platform_device_del(test0);
168 168
169exit_free_test1: 169exit_put_test1:
170 platform_device_put(test1); 170 platform_device_put(test1);
171 171
172exit_free_test0: 172exit_put_test0:
173 platform_device_put(test0); 173 platform_device_put(test0);
174 174
175exit_driver_unregister: 175exit_driver_unregister: