lkml.org 
[lkml]   [2016]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v5 2/7] drm/nouveau/core: make use of new strlcpytolower() function
Date
Call strlcpytolower() rather than copying the string explicitly and
then walking it to convert it to lowercase.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
index 34ecd4a..982601e 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/firmware.c
@@ -36,16 +36,9 @@ nvkm_firmware_get(struct nvkm_device *device, const char *fwname,
{
char f[64];
char cname[16];
- int i;

/* Convert device name to lowercase */
- strncpy(cname, device->chip->name, sizeof(cname));
- cname[sizeof(cname) - 1] = '\0';
- i = strlen(cname);
- while (i) {
- --i;
- cname[i] = tolower(cname[i]);
- }
+ strlcpytolower(cname, device->chip->name, sizeof(cname));

snprintf(f, sizeof(f), "nvidia/%s/%s.bin", cname, fwname);
return request_firmware(fw, f, device->dev);
--
2.7.4
\
 
 \ /
  Last update: 2016-08-11 00:01    [W:0.041 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site