From: Julia Lawall <julia.lawall@lip6.fr>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Julia Lawall <julia@diku.dk>,
Samuel Ortiz <sameo@linux.intel.com>,
kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: devm_kfree
Date: Mon, 26 Dec 2011 14:44:58 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.02.1112261440450.1873@localhost6.localdomain6> (raw)
In-Reply-To: <20111226120855.GB17760@sirena.org.uk>
Is it reasonable to use devm_kfree in a probe function that fails or a
remove function that succeeds?
Examples from drivers/watchdog/shwdt.c:
sh_wdt_probe:
...
out_unreg:
unregister_reboot_notifier(&sh_wdt_notifier);
out_unmap:
- devm_iounmap(&pdev->dev, wdt->base);
out_err:
- devm_kfree(&pdev->dev, wdt);
out_release:
- devm_release_mem_region(&pdev->dev, res->start,
resource_size(res));
return rc;
}
sh_wdt_remove:
...
unregister_reboot_notifier(&sh_wdt_notifier);
devm_release_mem_region(&pdev->dev, res->start, resource_size(res));
devm_iounmap(&pdev->dev, wdt->base);
devm_kfree(&pdev->dev, wdt);
return 0;
}
On the other hand, perhaps devm_kfree is needed in probe function that
succeeds, eg in drivers/input/keyboard/samsung-keypad.c:
if (pdev->dev.of_node) {
devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap);
devm_kfree(&pdev->dev, (void *)pdata->keymap_data);
devm_kfree(&pdev->dev, (void *)pdata);
}
return 0;
julia
next prev parent reply other threads:[~2011-12-26 13:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-23 17:39 [PATCH 1/9] drivers/mfd/88pm860x-i2c.c: introduce missing kfree Julia Lawall
2011-12-26 12:08 ` Mark Brown
2011-12-26 12:18 ` Julia Lawall
2011-12-26 12:20 ` Mark Brown
2011-12-26 13:44 ` Julia Lawall [this message]
2011-12-26 14:23 ` devm_kfree Mark Brown
2011-12-26 16:17 ` devm_kfree Julia Lawall
2011-12-26 16:19 ` devm_kfree Mark Brown
2011-12-27 2:48 ` devm_kfree Adam Jiang
2011-12-27 6:10 ` devm_kfree Julia Lawall
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=alpine.DEB.2.02.1112261440450.1873@localhost6.localdomain6 \
--to=julia.lawall@lip6.fr \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=julia@diku.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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®