From: Jingoo Han <jg1.han@samsung.com>
To: "'Anton Vorontsov'" <anton@enomsg.org>
Cc: "'David Woodhouse'" <dwmw2@infradead.org>,
linux-kernel@vger.kernel.org,
"'Jingoo Han'" <jg1.han@samsung.com>
Subject: [PATCH 06/14] power: ds2780_battery: use devm_kzalloc()
Date: Mon, 11 Mar 2013 15:33:05 +0900 [thread overview]
Message-ID: <007601ce1e22$4a1032e0$de3098a0$%han@samsung.com> (raw)
In-Reply-To: <007101ce1e21$f39efcc0$dadcf640$%han@samsung.com>
Use devm_kzalloc() to make cleanup paths more simple.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/power/ds2780_battery.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/power/ds2780_battery.c b/drivers/power/ds2780_battery.c
index 8b6c453..9f418fa 100644
--- a/drivers/power/ds2780_battery.c
+++ b/drivers/power/ds2780_battery.c
@@ -760,7 +760,7 @@ static int ds2780_battery_probe(struct platform_device *pdev)
int ret = 0;
struct ds2780_device_info *dev_info;
- dev_info = kzalloc(sizeof(*dev_info), GFP_KERNEL);
+ dev_info = devm_kzalloc(&pdev->dev, sizeof(*dev_info), GFP_KERNEL);
if (!dev_info) {
ret = -ENOMEM;
goto fail;
@@ -779,7 +779,7 @@ static int ds2780_battery_probe(struct platform_device *pdev)
ret = power_supply_register(&pdev->dev, &dev_info->bat);
if (ret) {
dev_err(dev_info->dev, "failed to register battery\n");
- goto fail_free_info;
+ goto fail;
}
ret = sysfs_create_group(&dev_info->bat.dev->kobj, &ds2780_attr_group);
@@ -813,8 +813,6 @@ fail_remove_group:
sysfs_remove_group(&dev_info->bat.dev->kobj, &ds2780_attr_group);
fail_unregister:
power_supply_unregister(&dev_info->bat);
-fail_free_info:
- kfree(dev_info);
fail:
return ret;
}
@@ -828,7 +826,6 @@ static int ds2780_battery_remove(struct platform_device *pdev)
power_supply_unregister(&dev_info->bat);
- kfree(dev_info);
return 0;
}
--
1.7.2.5
next prev parent reply other threads:[~2013-03-11 6:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-11 6:30 [PATCH 01/14] power: 88pm860x_charger: drop kfree of devm_kzalloc'd data Jingoo Han
2013-03-11 6:31 ` [PATCH 02/14] power: max8925_power: use devm_kzalloc() Jingoo Han
2013-03-11 6:31 ` [PATCH 03/14] power: da9030_battery: " Jingoo Han
2013-03-11 6:32 ` [PATCH 04/14] power: da9052-battery: " Jingoo Han
2013-03-11 6:32 ` [PATCH 05/14] power: ds2760_battery: " Jingoo Han
2013-03-11 6:33 ` Jingoo Han [this message]
2013-03-11 6:33 ` [PATCH 07/14] power: gpio-charger: " Jingoo Han
2013-03-11 6:34 ` [PATCH 08/14] power: isp1704_charger: " Jingoo Han
2013-03-11 6:34 ` [PATCH 09/14] power: max8903_charger: " Jingoo Han
2013-03-11 6:34 ` [PATCH 10/14] power: max8997_charger: " Jingoo Han
2013-03-11 6:35 ` [PATCH 11/14] power: max8998_charger: " Jingoo Han
2013-03-11 6:35 ` [PATCH 12/14] power: pcf50633-charger: " Jingoo Han
2013-03-11 6:35 ` [PATCH 13/14] power: rx51_battery: " Jingoo Han
2013-03-11 6:36 ` [PATCH 14/14] power: wm831x_backup: " Jingoo Han
2013-04-01 6:29 ` [PATCH 01/14] power: 88pm860x_charger: drop kfree of devm_kzalloc'd data Anton Vorontsov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='007601ce1e22$4a1032e0$de3098a0$%han@samsung.com' \
--to=jg1.han@samsung.com \
--cc=anton@enomsg.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®