Commit 9c9ac2e6 authored by Wolfram Sang's avatar Wolfram Sang Committed by Hans de Goede

platform/x86: move from strlcpy with unused retval to strscpy

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: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
Link: https://lore.kernel.org/r/20220818210058.7229-1-wsa+renesas@sang-engineering.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 8028d5d4
...@@ -519,7 +519,7 @@ static int mshw0011_probe(struct i2c_client *client) ...@@ -519,7 +519,7 @@ static int mshw0011_probe(struct i2c_client *client)
i2c_set_clientdata(client, data); i2c_set_clientdata(client, data);
memset(&board_info, 0, sizeof(board_info)); memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE); strscpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
bat0 = i2c_acpi_new_device(dev, 1, &board_info); bat0 = i2c_acpi_new_device(dev, 1, &board_info);
if (IS_ERR(bat0)) if (IS_ERR(bat0))
......
...@@ -270,7 +270,7 @@ void strlcpy_attr(char *dest, char *src) ...@@ -270,7 +270,7 @@ void strlcpy_attr(char *dest, char *src)
size_t len = strlen(src) + 1; size_t len = strlen(src) + 1;
if (len > 1 && len <= MAX_BUFF) if (len > 1 && len <= MAX_BUFF)
strlcpy(dest, src, len); strscpy(dest, src, len);
/*len can be zero because any property not-applicable to attribute can /*len can be zero because any property not-applicable to attribute can
* be empty so check only for too long buffers and log error * be empty so check only for too long buffers and log error
......
...@@ -270,7 +270,7 @@ cht_int33fe_register_max17047(struct device *dev, struct cht_int33fe_data *data) ...@@ -270,7 +270,7 @@ cht_int33fe_register_max17047(struct device *dev, struct cht_int33fe_data *data)
} }
memset(&board_info, 0, sizeof(board_info)); memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "max17047", I2C_NAME_SIZE); strscpy(board_info.type, "max17047", I2C_NAME_SIZE);
board_info.dev_name = "max17047"; board_info.dev_name = "max17047";
board_info.fwnode = fwnode; board_info.fwnode = fwnode;
data->battery_fg = i2c_acpi_new_device(dev, 1, &board_info); data->battery_fg = i2c_acpi_new_device(dev, 1, &board_info);
...@@ -361,7 +361,7 @@ static int cht_int33fe_typec_probe(struct platform_device *pdev) ...@@ -361,7 +361,7 @@ static int cht_int33fe_typec_probe(struct platform_device *pdev)
} }
memset(&board_info, 0, sizeof(board_info)); memset(&board_info, 0, sizeof(board_info));
strlcpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE); strscpy(board_info.type, "typec_fusb302", I2C_NAME_SIZE);
board_info.dev_name = "fusb302"; board_info.dev_name = "fusb302";
board_info.fwnode = fwnode; board_info.fwnode = fwnode;
board_info.irq = fusb302_irq; board_info.irq = fusb302_irq;
...@@ -381,7 +381,7 @@ static int cht_int33fe_typec_probe(struct platform_device *pdev) ...@@ -381,7 +381,7 @@ static int cht_int33fe_typec_probe(struct platform_device *pdev)
memset(&board_info, 0, sizeof(board_info)); memset(&board_info, 0, sizeof(board_info));
board_info.dev_name = "pi3usb30532"; board_info.dev_name = "pi3usb30532";
board_info.fwnode = fwnode; board_info.fwnode = fwnode;
strlcpy(board_info.type, "pi3usb30532", I2C_NAME_SIZE); strscpy(board_info.type, "pi3usb30532", I2C_NAME_SIZE);
data->pi3usb30532 = i2c_acpi_new_device(dev, 3, &board_info); data->pi3usb30532 = i2c_acpi_new_device(dev, 3, &board_info);
if (IS_ERR(data->pi3usb30532)) { if (IS_ERR(data->pi3usb30532)) {
......
...@@ -7623,9 +7623,9 @@ static int __init volume_create_alsa_mixer(void) ...@@ -7623,9 +7623,9 @@ static int __init volume_create_alsa_mixer(void)
data = card->private_data; data = card->private_data;
data->card = card; data->card = card;
strlcpy(card->driver, TPACPI_ALSA_DRVNAME, strscpy(card->driver, TPACPI_ALSA_DRVNAME,
sizeof(card->driver)); sizeof(card->driver));
strlcpy(card->shortname, TPACPI_ALSA_SHRTNAME, strscpy(card->shortname, TPACPI_ALSA_SHRTNAME,
sizeof(card->shortname)); sizeof(card->shortname));
snprintf(card->mixername, sizeof(card->mixername), "ThinkPad EC %s", snprintf(card->mixername, sizeof(card->mixername), "ThinkPad EC %s",
(thinkpad_id.ec_version_str) ? (thinkpad_id.ec_version_str) ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment