Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd: cleanup get_mfd_cell_dev()

It's simpler to just use snprintf() to print this to one buffer instead
of using strcpy() and strcat(). Also using snprintf() is slightly safer
than using sprintf().

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Dan Carpenter and committed by
Alex Deucher
a65ecc40 70eacc72

+2 -4
+2 -4
drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
··· 240 240 static struct device *get_mfd_cell_dev(const char *device_name, int r) 241 241 { 242 242 char auto_dev_name[25]; 243 - char buf[8]; 244 243 struct device *dev; 245 244 246 - sprintf(buf, ".%d.auto", r); 247 - strcpy(auto_dev_name, device_name); 248 - strcat(auto_dev_name, buf); 245 + snprintf(auto_dev_name, sizeof(auto_dev_name), 246 + "%s.%d.auto", device_name, r); 249 247 dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name); 250 248 dev_info(dev, "device %s added to pm domain\n", auto_dev_name); 251 249