In commit b6b2735514bc
("tracing: Use str_has_prefix() instead of using fixed sizes")
the newly introduced str_has_prefix() was used
to replace error-prone strncmp(str, const, len).
Here fix codes with the same pattern.

Signed-off-by: Chuhong Yuan <hsleste...@gmail.com>
---
 arch/arm/kernel/module-plts.c        | 2 +-
 arch/arm/mach-omap2/omap_device.c    | 4 ++--
 arch/arm/mach-omap2/pm-debug.c       | 8 ++++----
 arch/arm/mach-omap2/pm.c             | 2 +-
 arch/arm/mach-omap2/pm44xx.c         | 2 +-
 arch/arm/mach-omap2/sr_device.c      | 8 ++++----
 arch/arm/mach-orion5x/ts78xx-setup.c | 4 ++--
 7 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/arch/arm/kernel/module-plts.c b/arch/arm/kernel/module-plts.c
index b647741c0ab0..92485a90fb63 100644
--- a/arch/arm/kernel/module-plts.c
+++ b/arch/arm/kernel/module-plts.c
@@ -230,7 +230,7 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr 
*sechdrs,
                /* sort by type and symbol index */
                sort(rels, numrels, sizeof(Elf32_Rel), cmp_rel, NULL);
 
-               if (strncmp(secstrings + dstsec->sh_name, ".init", 5) != 0)
+               if (!str_has_prefix(secstrings + dstsec->sh_name, ".init"))
                        core_plts += count_plts(syms, dstsec->sh_addr, rels,
                                                numrels, s->sh_info);
                else
diff --git a/arch/arm/mach-omap2/omap_device.c 
b/arch/arm/mach-omap2/omap_device.c
index 3acb4192918d..8ef38529f0a7 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -492,8 +492,8 @@ struct platform_device __init *omap_device_build(const char 
*pdev_name,
        if (!pdata && pdata_len > 0)
                return ERR_PTR(-EINVAL);
 
-       if (strncmp(oh->name, "smartreflex", 11) &&
-           strncmp(oh->name, "dma", 3)) {
+       if (!str_has_prefix(oh->name, "smartreflex") &&
+           !str_has_prefix(oh->name, "dma")) {
                pr_warn("%s need to update %s to probe with dt\na",
                        __func__, pdev_name);
                ret = -ENODEV;
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index fceb1e525d26..5aeac364c3de 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -72,7 +72,7 @@ static int clkdm_dbg_show_counter(struct clockdomain *clkdm, 
void *user)
 
        if (strcmp(clkdm->name, "emu_clkdm") == 0 ||
                strcmp(clkdm->name, "wkup_clkdm") == 0 ||
-               strncmp(clkdm->name, "dpll", 4) == 0)
+               str_has_prefix(clkdm->name, "dpll"))
                return 0;
 
        seq_printf(s, "%s->%s (%d)\n", clkdm->name, clkdm->pwrdm.ptr->name,
@@ -88,7 +88,7 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, 
void *user)
 
        if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
                strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
-               strncmp(pwrdm->name, "dpll", 4) == 0)
+               str_has_prefix(pwrdm->name, "dpll"))
                return 0;
 
        if (pwrdm->state != pwrdm_read_pwrst(pwrdm))
@@ -117,7 +117,7 @@ static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, 
void *user)
 
        if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
                strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
-               strncmp(pwrdm->name, "dpll", 4) == 0)
+               str_has_prefix(pwrdm->name, "dpll"))
                return 0;
 
        pwrdm_state_switch(pwrdm);
@@ -186,7 +186,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, 
void *dir)
 
        pwrdm->timer = t;
 
-       if (strncmp(pwrdm->name, "dpll", 4) == 0)
+       if (str_has_prefix(pwrdm->name, "dpll"))
                return 0;
 
        d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1fde1bf53fb6..d3287ec5d8da 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -96,7 +96,7 @@ static int __init omap2_set_init_voltage(char *vdd_name, char 
*clk_name,
                goto exit;
        }
 
-       if (!strncmp(oh_name, "mpu", 3))
+       if (str_has_prefix(oh_name, "mpu"))
                /* 
                 * All current OMAPs share voltage rail and clock
                 * source, so CPU0 is used to represent the MPU-SS.
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c
index 485550af2506..4ba30e690b5a 100644
--- a/arch/arm/mach-omap2/pm44xx.c
+++ b/arch/arm/mach-omap2/pm44xx.c
@@ -122,7 +122,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, 
void *unused)
         * through hotplug path and CPU0 explicitly programmed
         * further down in the code path
         */
-       if (!strncmp(pwrdm->name, "cpu", 3)) {
+       if (str_has_prefix(pwrdm->name, "cpu")) {
                if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE))
                        cpu_suspend_state = PWRDM_POWER_RET;
                return 0;
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 62df666c2bd0..885c75e26a2f 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -95,12 +95,12 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void 
*user)
        struct omap_smartreflex_dev_attr *sr_dev_attr;
        static int i;
 
-       if (!strncmp(oh->name, "smartreflex_mpu_iva", 20) ||
-           !strncmp(oh->name, "smartreflex_mpu", 16))
+       if (str_has_prefix(oh->name, "smartreflex_mpu_iva") ||
+           str_has_prefix(oh->name, "smartreflex_mpu"))
                sr_data = &omap_sr_pdata[OMAP_SR_MPU];
-       else if (!strncmp(oh->name, "smartreflex_core", 17))
+       else if (str_has_prefix(oh->name, "smartreflex_core"))
                sr_data = &omap_sr_pdata[OMAP_SR_CORE];
-       else if (!strncmp(oh->name, "smartreflex_iva", 16))
+       else if (str_has_prefix(oh->name, "smartreflex_iva"))
                sr_data = &omap_sr_pdata[OMAP_SR_IVA];
 
        if (!sr_data) {
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c 
b/arch/arm/mach-orion5x/ts78xx-setup.c
index fda9b75c3a33..d83791f0e2da 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -477,9 +477,9 @@ static ssize_t ts78xx_fpga_store(struct kobject *kobj,
                return -EBUSY;
        }
 
-       if (strncmp(buf, "online", sizeof("online") - 1) == 0)
+       if (str_has_prefix(buf, "online"))
                value = 1;
-       else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0)
+       else if (str_has_prefix(buf, "offline"))
                value = 0;
        else
                return -EINVAL;
-- 
2.20.1

Reply via email to