Re: [RFC][PATCH] PM / Wakeup: Introduce wakeup source objects and event statistics (was: Re: Wakeup-events implementation)

From: Rafael J. Wysocki
Date: Fri Sep 10 2010 - 18:30:48 EST


On Friday, September 10, 2010, Rafael J. Wysocki wrote:
> On Friday, September 10, 2010, Alan Stern wrote:
> > On Wed, 8 Sep 2010, Rafael J. Wysocki wrote:
> >
> > > +struct wakeup_source *wakeup_source_create(const char *name)
> > > +{
> > > + struct wakeup_source *ws;
> > > +
> > > + ws = kzalloc(sizeof(*ws), GFP_KERNEL);
> > > + if (!ws)
> > > + return NULL;
> > > +
> > > + if (name) {
> > > + int len = strlen(name);
> > > + char *s = kzalloc(len + 1, GFP_KERNEL);
> > > + if (s) {
> > > + strncpy(s, name, len);
> > > + ws->name = s;
> > > + }
> > > + }
> > > +
> > > + return ws;
> > > +}
> >
> > Forget what I wrote earlier; it was stupid. Just use kstrdup.

Right, I didn't know it existed. :-)

Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/