rtc: rtc-rx8025: 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>
This commit is contained in:
Родитель
618c300305
Коммит
fac42b414a
|
@ -549,7 +549,7 @@ static int rx8025_probe(struct i2c_client *client,
|
|||
goto errout;
|
||||
}
|
||||
|
||||
rx8025 = kzalloc(sizeof(*rx8025), GFP_KERNEL);
|
||||
rx8025 = devm_kzalloc(&client->dev, sizeof(*rx8025), GFP_KERNEL);
|
||||
if (!rx8025) {
|
||||
dev_err(&adapter->dev, "failed to alloc memory\n");
|
||||
err = -ENOMEM;
|
||||
|
@ -562,7 +562,7 @@ static int rx8025_probe(struct i2c_client *client,
|
|||
|
||||
err = rx8025_init_client(client, &need_reset);
|
||||
if (err)
|
||||
goto errout_free;
|
||||
goto errout;
|
||||
|
||||
if (need_reset) {
|
||||
struct rtc_time tm;
|
||||
|
@ -572,12 +572,12 @@ static int rx8025_probe(struct i2c_client *client,
|
|||
rx8025_set_time(&client->dev, &tm);
|
||||
}
|
||||
|
||||
rx8025->rtc = rtc_device_register(client->name, &client->dev,
|
||||
rx8025->rtc = devm_rtc_device_register(&client->dev, client->name,
|
||||
&rx8025_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(rx8025->rtc)) {
|
||||
err = PTR_ERR(rx8025->rtc);
|
||||
dev_err(&client->dev, "unable to register the class device\n");
|
||||
goto errout_free;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
if (client->irq > 0) {
|
||||
|
@ -586,7 +586,7 @@ static int rx8025_probe(struct i2c_client *client,
|
|||
0, "rx8025", client);
|
||||
if (err) {
|
||||
dev_err(&client->dev, "unable to request IRQ\n");
|
||||
goto errout_reg;
|
||||
goto errout;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -603,12 +603,6 @@ errout_irq:
|
|||
if (client->irq > 0)
|
||||
free_irq(client->irq, client);
|
||||
|
||||
errout_reg:
|
||||
rtc_device_unregister(rx8025->rtc);
|
||||
|
||||
errout_free:
|
||||
kfree(rx8025);
|
||||
|
||||
errout:
|
||||
dev_err(&adapter->dev, "probing for rx8025 failed\n");
|
||||
return err;
|
||||
|
@ -629,8 +623,6 @@ static int rx8025_remove(struct i2c_client *client)
|
|||
}
|
||||
|
||||
rx8025_sysfs_unregister(&client->dev);
|
||||
rtc_device_unregister(rx8025->rtc);
|
||||
kfree(rx8025);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче