lkml.org 
[lkml]   [2010]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] PM / Wakeup: Introduce wakeup source objects and event statistics (was: Re: Wakeup-events implementation)
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.

Alan Stern



\
 
 \ /
  Last update: 2010-09-10 17:23    [W:0.088 / U:0.432 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site