[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADnq5_NDQgaEMpGenhz7b8Y=_R9L9OinQDZpiuiZ=KkiSUsO0w@mail.gmail.com>
Date: Fri, 26 Feb 2016 12:46:58 -0500
From: Alex Deucher <alexdeucher@...il.com>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: David Airlie <airlied@...ux.ie>,
Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@....com>,
Jammy Zhou <Jammy.Zhou@....com>,
kernel-janitors@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
Alex Deucher <alexander.deucher@....com>,
Murali Krishna Vemuri <murali-krishna.vemuri@....com>
Subject: Re: [patch] drm/amd: cleanup get_mfd_cell_dev()
On Thu, Feb 25, 2016 at 2:47 AM, Dan Carpenter <dan.carpenter@...cle.com> wrote:
> 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@...cle.com>
Applied. Thanks!
>
> 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);
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Powered by blists - more mailing lists