mfd: Move from strlcpy with unused retval to strscpy
authorWolfram Sang <wsa+renesas@sang-engineering.com>
Thu, 18 Aug 2022 21:00:29 +0000 (23:00 +0200)
committerLee Jones <lee@kernel.org>
Wed, 28 Sep 2022 15:17:39 +0000 (16:17 +0100)
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20220818210030.7012-1-wsa+renesas@sang-engineering.com
drivers/mfd/htc-i2cpld.c
drivers/mfd/lpc_ich.c
drivers/mfd/mfd-core.c

index 417b0355d904d43be8c2a32047f8f21659a3157d..9232b4ba034d5cb2eb1b8ba283e3493ac44536ac 100644 (file)
@@ -352,7 +352,7 @@ static int htcpld_register_chip_i2c(
 
        memset(&info, 0, sizeof(struct i2c_board_info));
        info.addr = plat_chip_data->addr;
-       strlcpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
+       strscpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
        info.platform_data = chip;
 
        /* Add the I2C device.  This calls the probe() function. */
index 650951f89f1c9e9cb4df513cc5f351e6a65c9757..7b1c597b6879fb38d6c9a3a34e2d6baa9ade66d1 100644 (file)
@@ -959,7 +959,7 @@ static int lpc_ich_finalize_wdt_cell(struct pci_dev *dev)
        info = &lpc_chipset_info[priv->chipset];
 
        pdata->version = info->iTCO_version;
-       strlcpy(pdata->name, info->name, sizeof(pdata->name));
+       strscpy(pdata->name, info->name, sizeof(pdata->name));
 
        cell->platform_data = pdata;
        cell->pdata_size = sizeof(*pdata);
index 5ec5d76a667df1accb225c63e88925db6592fd27..16d1861e96823c1402672457e029c516c348e040 100644 (file)
@@ -105,7 +105,7 @@ static void mfd_acpi_add_device(const struct mfd_cell *cell,
                                .ids = ids,
                        };
 
-                       strlcpy(ids[0].id, match->pnpid, sizeof(ids[0].id));
+                       strscpy(ids[0].id, match->pnpid, sizeof(ids[0].id));
                        acpi_dev_for_each_child(parent, match_device_ids, &wd);
                        adev = wd.adev;
                } else {