diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 16:20:53 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 18:28:38 -0700 |
commit | b4cd3d6a77b3f8acfd5b8ae9ea9dc43f831f0df9 (patch) | |
tree | c5db44de4a85e8764b658113991d0dcf21a62f55 | |
parent | b8a4b4e2f76d660c36afd1c4a5f5ff578dc7b124 (diff) | |
download | linux-b4cd3d6a77b3f8acfd5b8ae9ea9dc43f831f0df9.tar.gz linux-b4cd3d6a77b3f8acfd5b8ae9ea9dc43f831f0df9.tar.bz2 linux-b4cd3d6a77b3f8acfd5b8ae9ea9dc43f831f0df9.zip |
rtc: rtc-s35390a: use devm_*() functions
Use devm_*() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/rtc/rtc-s35390a.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c index 8a092325188d..f40afdd0e5f5 100644 --- a/drivers/rtc/rtc-s35390a.c +++ b/drivers/rtc/rtc-s35390a.c @@ -338,7 +338,8 @@ static int s35390a_probe(struct i2c_client *client, goto exit; } - s35390a = kzalloc(sizeof(struct s35390a), GFP_KERNEL); + s35390a = devm_kzalloc(&client->dev, sizeof(struct s35390a), + GFP_KERNEL); if (!s35390a) { err = -ENOMEM; goto exit; @@ -386,8 +387,9 @@ static int s35390a_probe(struct i2c_client *client, device_set_wakeup_capable(&client->dev, 1); - s35390a->rtc = rtc_device_register(s35390a_driver.driver.name, - &client->dev, &s35390a_rtc_ops, THIS_MODULE); + s35390a->rtc = devm_rtc_device_register(&client->dev, + s35390a_driver.driver.name, + &s35390a_rtc_ops, THIS_MODULE); if (IS_ERR(s35390a->rtc)) { err = PTR_ERR(s35390a->rtc); @@ -399,7 +401,6 @@ exit_dummy: for (i = 1; i < 8; ++i) if (s35390a->client[i]) i2c_unregister_device(s35390a->client[i]); - kfree(s35390a); exit: return err; @@ -408,15 +409,12 @@ exit: static int s35390a_remove(struct i2c_client *client) { unsigned int i; - struct s35390a *s35390a = i2c_get_clientdata(client); + for (i = 1; i < 8; ++i) if (s35390a->client[i]) i2c_unregister_device(s35390a->client[i]); - rtc_device_unregister(s35390a->rtc); - kfree(s35390a); - return 0; } |