From: Andy Shevchenko Date: Fri, 4 Aug 2023 14:39:08 +0000 (+0300) Subject: driver core: Replace kstrdup() + strreplace() with kstrdup_and_replace() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=7f146b24297bf58c19f916aee530155c830c5598;p=linux.git 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 Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20230804143910.15504-3-andriy.shevchenko@linux.intel.com Signed-off-by: Stephen Boyd --- diff --git a/drivers/base/core.c b/drivers/base/core.c index 3dff5037943e0..af0ee691520a3 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -28,6 +27,7 @@ #include #include #include +#include #include #include #include /* 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; }