diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-08-04 17:39:08 +0300 |
---|---|---|
committer | Stephen Boyd <sboyd@kernel.org> | 2023-08-05 04:21:50 +0300 |
commit | 7f146b24297bf58c19f916aee530155c830c5598 (patch) | |
tree | f85b8761532cc3ff6700d3e4b2e5bff32f68dc04 /drivers/base | |
parent | 045ad46441a1cf2ff358af0126f8c57f337804fa (diff) | |
download | linux-7f146b24297bf58c19f916aee530155c830c5598.tar.xz |
driver core: Replace kstrdup() + strreplace() with kstrdup_and_replace()
Replace open coded functionality of kstrdup_and_replace() with a call.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230804143910.15504-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/core.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3dff5037943e..af0ee691520a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -17,7 +17,6 @@ #include <linux/kstrtox.h> #include <linux/module.h> #include <linux/slab.h> -#include <linux/string.h> #include <linux/kdev_t.h> #include <linux/notifier.h> #include <linux/of.h> @@ -28,6 +27,7 @@ #include <linux/netdevice.h> #include <linux/sched/signal.h> #include <linux/sched/mm.h> +#include <linux/string_helpers.h> #include <linux/swiotlb.h> #include <linux/sysfs.h> #include <linux/dma-map-ops.h> /* for dma_default_coherent */ @@ -3910,10 +3910,9 @@ const char *device_get_devnode(const struct device *dev, return dev_name(dev); /* replace '!' in the name with '/' */ - s = kstrdup(dev_name(dev), GFP_KERNEL); + s = kstrdup_and_replace(dev_name(dev), '!', '/', GFP_KERNEL); if (!s) return NULL; - strreplace(s, '!', '/'); return *tmp = s; } |