]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
bus: rifsc: Replace snprintf("%s") with strscpy
authorThorsten Blum <thorsten.blum@linux.dev>
Mon, 23 Feb 2026 21:12:11 +0000 (22:12 +0100)
committerAlexandre Torgue <alexandre.torgue@foss.st.com>
Wed, 25 Mar 2026 16:40:21 +0000 (17:40 +0100)
Replace snprintf("%s", ...) with the faster and more direct strscpy().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Link: https://lore.kernel.org/r/20260223211212.344855-1-thorsten.blum@linux.dev
Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
drivers/bus/stm32_rifsc.c

index 65990ae8dd08abe80021cb8213c58ebb9686d5ec..ab8d4e3128c3a02a0ea138a1ac03668d4eb0d764 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/string.h>
 #include <linux/types.h>
 
 /*
@@ -449,7 +450,7 @@ static void stm32_rifsc_fill_rimu_dbg_entry(struct rifsc_dbg_private *rifsc,
        const struct stm32_rifsc_resources_names *dbg_names = rifsc->res_names;
        u32 rimc_attr = readl_relaxed(rifsc->mmio + RIFSC_RIMC_ATTR0 + 0x4 * i);
 
-       snprintf(dbg_entry->m_name, sizeof(dbg_entry->m_name), "%s", dbg_names->initiator_names[i]);
+       strscpy(dbg_entry->m_name, dbg_names->initiator_names[i]);
        dbg_entry->m_cid = FIELD_GET(RIFSC_RIMC_MCID_MASK, rimc_attr);
        dbg_entry->cidsel = rimc_attr & RIFSC_RIMC_CIDSEL;
        dbg_entry->m_sec = rimc_attr & RIFSC_RIMC_MSEC;
@@ -468,8 +469,7 @@ static void stm32_rifsc_fill_dev_dbg_entry(struct rifsc_dbg_private *rifsc,
        sec_cfgr = readl_relaxed(rifsc->mmio + RIFSC_RISC_SECCFGR0 + 0x4 * reg_id);
        priv_cfgr = readl_relaxed(rifsc->mmio + RIFSC_RISC_PRIVCFGR0 + 0x4 * reg_id);
 
-       snprintf(dbg_entry->dev_name, sizeof(dbg_entry->dev_name), "%s",
-                dbg_names->device_names[i]);
+       strscpy(dbg_entry->dev_name, dbg_names->device_names[i]);
        dbg_entry->dev_id = i;
        dbg_entry->dev_cid_filt_en = cid_cfgr & CIDCFGR_CFEN;
        dbg_entry->dev_sem_en = cid_cfgr & CIDCFGR_SEMEN;