public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] drm/amd: cleanup get_mfd_cell_dev()
@ 2016-02-25  7:47 Dan Carpenter
  2016-02-26 17:46 ` Alex Deucher
  2016-02-27  9:50 ` walter harms
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2016-02-25  7:47 UTC (permalink / raw)
  To: David Airlie
  Cc: Alex Deucher, Maruthi Srinivas Bayyavarapu, Jammy Zhou,
	Murali Krishna Vemuri, Chunming Zhou, dri-devel, linux-kernel,
	kernel-janitors

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>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
index 9f8cfaa..d6b0bff 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
@@ -240,12 +240,10 @@ static int acp_poweron(struct generic_pm_domain *genpd)
 static struct device *get_mfd_cell_dev(const char *device_name, int r)
 {
 	char auto_dev_name[25];
-	char buf[8];
 	struct device *dev;
 
-	sprintf(buf, ".%d.auto", r);
-	strcpy(auto_dev_name, device_name);
-	strcat(auto_dev_name, buf);
+	snprintf(auto_dev_name, sizeof(auto_dev_name),
+		 "%s.%d.auto", device_name, r);
 	dev = bus_find_device_by_name(&platform_bus_type, NULL, auto_dev_name);
 	dev_info(dev, "device %s added to pm domain\n", auto_dev_name);
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-02-27 11:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25  7:47 [patch] drm/amd: cleanup get_mfd_cell_dev() Dan Carpenter
2016-02-26 17:46 ` Alex Deucher
2016-02-27  9:50 ` walter harms
2016-02-27 10:40   ` Dan Carpenter
2016-02-27 11:18     ` walter harms

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox