mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
2abf114fc8
commit
a29fd614a6
1 changed files with 4 additions and 5 deletions
|
|
@ -1303,12 +1303,11 @@ const char *device_get_devnode(struct device *dev,
|
|||
return dev_name(dev);
|
||||
|
||||
/* replace '!' in the name with '/' */
|
||||
*tmp = kstrdup(dev_name(dev), GFP_KERNEL);
|
||||
if (!*tmp)
|
||||
s = kstrdup(dev_name(dev), GFP_KERNEL);
|
||||
if (!s)
|
||||
return NULL;
|
||||
while ((s = strchr(*tmp, '!')))
|
||||
s[0] = '/';
|
||||
return *tmp;
|
||||
strreplace(s, '!', '/');
|
||||
return *tmp = s;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue