]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bus: fsl-mc: Use strscpy() instead of strscpy_pad()
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 29 Apr 2025 10:41:48 +0000 (12:41 +0200)
committerChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 12 May 2025 23:39:01 +0000 (01:39 +0200)
Both destination buffers are already zero-initialized, making strscpy()
sufficient for safely copying 'obj_type'. The additional NUL-padding
performed by strscpy_pad() is unnecessary.

If the destination buffer has a fixed length, strscpy() automatically
determines its size using sizeof() when the argument is omitted. This
makes the explicit size arguments unnecessary.

No functional changes intended.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20250429104149.66334-1-thorsten.blum@linux.dev
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
drivers/bus/fsl-mc/dprc.c

index dd1b5c0fb7e26d6ae939e61ac6713d42ae66596b..38d40c09b7190aac446698787e00681f62a19a56 100644 (file)
@@ -489,7 +489,7 @@ int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
        cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr);
        cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num);
        cmd_params->obj_id = cpu_to_le32(obj_id);
-       strscpy_pad(cmd_params->obj_type, obj_type, 16);
+       strscpy(cmd_params->obj_type, obj_type);
 
        /* send command to mc*/
        return mc_send_command(mc_io, &cmd);
@@ -561,7 +561,7 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io,
        cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params;
        cmd_params->obj_id = cpu_to_le32(obj_id);
        cmd_params->region_index = region_index;
-       strscpy_pad(cmd_params->obj_type, obj_type, 16);
+       strscpy(cmd_params->obj_type, obj_type);
 
        /* send command to mc*/
        err = mc_send_command(mc_io, &cmd);