diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-04-29 19:20:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-29 21:28:37 -0400 |
commit | dc831f9768a0fe898d8d3bc6f738d8079a6f5d7a (patch) | |
tree | c03ff5c767b9f5a58de6a2fb2715a14782805aa0 /drivers/rtc | |
parent | c54a52e3a842c63adf724f1d457933a1ce1dc007 (diff) |
rtc: rtc-isl12022: 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>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-isl12022.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-isl12022.c b/drivers/rtc/rtc-isl12022.c index 6b4298ea683d..1af0aa5cbd27 100644 --- a/drivers/rtc/rtc-isl12022.c +++ b/drivers/rtc/rtc-isl12022.c | |||
@@ -252,12 +252,11 @@ static int isl12022_probe(struct i2c_client *client, | |||
252 | { | 252 | { |
253 | struct isl12022 *isl12022; | 253 | struct isl12022 *isl12022; |
254 | 254 | ||
255 | int ret = 0; | ||
256 | |||
257 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) | 255 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) |
258 | return -ENODEV; | 256 | return -ENODEV; |
259 | 257 | ||
260 | isl12022 = kzalloc(sizeof(struct isl12022), GFP_KERNEL); | 258 | isl12022 = devm_kzalloc(&client->dev, sizeof(struct isl12022), |
259 | GFP_KERNEL); | ||
261 | if (!isl12022) | 260 | if (!isl12022) |
262 | return -ENOMEM; | 261 | return -ENOMEM; |
263 | 262 | ||
@@ -265,31 +264,17 @@ static int isl12022_probe(struct i2c_client *client, | |||
265 | 264 | ||
266 | i2c_set_clientdata(client, isl12022); | 265 | i2c_set_clientdata(client, isl12022); |
267 | 266 | ||
268 | isl12022->rtc = rtc_device_register(isl12022_driver.driver.name, | 267 | isl12022->rtc = devm_rtc_device_register(&client->dev, |
269 | &client->dev, | 268 | isl12022_driver.driver.name, |
270 | &isl12022_rtc_ops, | 269 | &isl12022_rtc_ops, THIS_MODULE); |
271 | THIS_MODULE); | 270 | if (IS_ERR(isl12022->rtc)) |
272 | 271 | return PTR_ERR(isl12022->rtc); | |
273 | if (IS_ERR(isl12022->rtc)) { | ||
274 | ret = PTR_ERR(isl12022->rtc); | ||
275 | goto exit_kfree; | ||
276 | } | ||
277 | 272 | ||
278 | return 0; | 273 | return 0; |
279 | |||
280 | exit_kfree: | ||
281 | kfree(isl12022); | ||
282 | |||
283 | return ret; | ||
284 | } | 274 | } |
285 | 275 | ||
286 | static int isl12022_remove(struct i2c_client *client) | 276 | static int isl12022_remove(struct i2c_client *client) |
287 | { | 277 | { |
288 | struct isl12022 *isl12022 = i2c_get_clientdata(client); | ||
289 | |||
290 | rtc_device_unregister(isl12022->rtc); | ||
291 | kfree(isl12022); | ||
292 | |||
293 | return 0; | 278 | return 0; |
294 | } | 279 | } |
295 | 280 | ||