Commit a29fd614 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

drivers/base/core.c: use strreplace()

This eliminates a little .text and avoids repeating the strchr call when
we meet a '!' (which will happen at least once).
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2abf114f
...@@ -1303,12 +1303,11 @@ const char *device_get_devnode(struct device *dev, ...@@ -1303,12 +1303,11 @@ const char *device_get_devnode(struct device *dev,
return dev_name(dev); return dev_name(dev);
/* replace '!' in the name with '/' */ /* replace '!' in the name with '/' */
*tmp = kstrdup(dev_name(dev), GFP_KERNEL); s = kstrdup(dev_name(dev), GFP_KERNEL);
if (!*tmp) if (!s)
return NULL; return NULL;
while ((s = strchr(*tmp, '!'))) strreplace(s, '!', '/');
s[0] = '/'; return *tmp = s;
return *tmp;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment