From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] OMAP: omap_device: Add omap_device_[alloc|delete] for DT integration
Date: Sat, 17 Sep 2011 10:46:20 -0600 [thread overview]
Message-ID: <20110917164620.GX3523@ponder.secretlab.ca> (raw)
In-Reply-To: <20110917162701.GB16591@n2100.arm.linux.org.uk>
On Sat, Sep 17, 2011 at 05:27:01PM +0100, Russell King - ARM Linux wrote:
> On Sat, Sep 17, 2011 at 10:05:14AM -0600, Grant Likely wrote:
> > > +static struct omap_device *omap_device_alloc(struct platform_device *pdev,
> > > + struct omap_hwmod **ohs, int oh_cnt,
> > > + struct omap_device_pm_latency *pm_lats,
> > > + int pm_lats_cnt)
> > > +{
> > > + int ret = -ENOMEM;
> > > + struct omap_device *od;
> > > + struct resource *res = NULL;
> > > + int i, res_count;
> > > + struct omap_hwmod **hwmods;
> > > +
> > > + od = kzalloc(sizeof(struct omap_device), GFP_KERNEL);
> >
> > possible enhancement: devm_kzalloc() perhaps? Would simplify the cleanup
> > paths.
>
> Are you sure about that - have you thought about the lifetime issues?
> devm_*() lifetime is supposed to be from driver binding to driver
> unbinding.
>
> The lifetime of 'omap_device' appears to be from device creation to
> device destruction, which is different from what devm_*() gives you.
>
> So, using devm_*() will result in the 'omap_device' being destroyed
> when a driver is unbound - and presumably an oops if its attempted to
> be re-bound later (because the 'omap_device' structure will have been
> freed.)
Ugh, yes. You're absolutely right. devm_*() is doesn't at all work here.
g.
next prev parent reply other threads:[~2011-09-17 16:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-16 14:43 [PATCH v2 0/2] OMAP: omap_device: Add a method to build an omap_device from a DT node Benoit Cousson
2011-09-16 14:43 ` [PATCH v2 1/2] OMAP: omap_device: Add omap_device_[alloc|delete] for DT integration Benoit Cousson
2011-09-17 16:05 ` Grant Likely
2011-09-17 16:27 ` Russell King - ARM Linux
2011-09-17 16:46 ` Grant Likely [this message]
2011-09-19 13:11 ` Cousson, Benoit
2011-09-19 15:07 ` Cousson, Benoit
2011-09-16 14:43 ` [PATCH v2 2/2] OMAP: omap_device: Add a method to build an omap_device from a DT node Benoit Cousson
2011-09-17 16:13 ` Grant Likely
2011-09-19 13:22 ` Cousson, Benoit
2011-09-21 21:17 ` Kevin Hilman
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=20110917164620.GX3523@ponder.secretlab.ca \
--to=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).