diff options
author | Wei Yongjun | 2012-12-18 01:02:27 +0100 |
---|---|---|
committer | Linus Torvalds | 2012-12-18 02:15:20 +0100 |
commit | 942bfb3ed08b677e0a447096c501d6b0b49f44f9 (patch) | |
tree | 97856fa62b4042e6a55c2184c5aa4f4328533979 /drivers/rtc | |
parent | drivers/rtc/rtc-vt8500.c: convert to use devm_kzalloc (diff) | |
download | kernel-qcow2-linux-942bfb3ed08b677e0a447096c501d6b0b49f44f9.tar.gz kernel-qcow2-linux-942bfb3ed08b677e0a447096c501d6b0b49f44f9.tar.xz kernel-qcow2-linux-942bfb3ed08b677e0a447096c501d6b0b49f44f9.zip |
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.c | 14 |
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) if ((test1 = platform_device_alloc("rtc-test", 1)) == NULL) { err = -ENOMEM; - goto exit_free_test0; + goto exit_put_test0; } if ((err = platform_device_add(test0))) - goto exit_free_test1; + goto exit_put_test1; if ((err = platform_device_add(test1))) - goto exit_device_unregister; + goto exit_del_test0; return 0; -exit_device_unregister: - platform_device_unregister(test0); +exit_del_test0: + platform_device_del(test0); -exit_free_test1: +exit_put_test1: platform_device_put(test1); -exit_free_test0: +exit_put_test0: platform_device_put(test0); exit_driver_unregister: |