aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2015-06-25 18:02:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-25 20:00:40 -0400
commita29fd614a6af57610b1963e3445f1758c3806187 (patch)
tree7152686b1dfd8daa500e93739d305c6d9d2c5455 /drivers/base
parent2abf114fc841550a3e0c63afcd31c9781116fe42 (diff)
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: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/core.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 21d13038534e..dafae6d2f7ac 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -1303,12 +1303,11 @@ const char *device_get_devnode(struct device *dev,
1303 return dev_name(dev); 1303 return dev_name(dev);
1304 1304
1305 /* replace '!' in the name with '/' */ 1305 /* replace '!' in the name with '/' */
1306 *tmp = kstrdup(dev_name(dev), GFP_KERNEL); 1306 s = kstrdup(dev_name(dev), GFP_KERNEL);
1307 if (!*tmp) 1307 if (!s)
1308 return NULL; 1308 return NULL;
1309 while ((s = strchr(*tmp, '!'))) 1309 strreplace(s, '!', '/');
1310 s[0] = '/'; 1310 return *tmp = s;
1311 return *tmp;
1312} 1311}
1313 1312
1314/** 1313/**