drivers/intel/gma/acpi: Use snprintf() to construct device name

TEST=Booted ThinkPad X201s, backlight control still works.

Change-Id: Ieee02f698879ba6b60d863dd63ef9107c0d502b5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39728
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Nico Huber 2020-03-21 18:52:14 +01:00 committed by Patrick Georgi
parent 53c1717dc1
commit c0be410760
1 changed files with 2 additions and 6 deletions

View File

@ -50,8 +50,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *
acpigen_pop_len(); /* End Method. */ acpigen_pop_len(); /* End Method. */
for (i = 0; i < conf->ndid; i++) { for (i = 0; i < conf->ndid; i++) {
char name[10]; char name[5];
char *ptr;
int kind; int kind;
kind = (conf->did[i] >> 8) & 0xf; kind = (conf->did[i] >> 8) & 0xf;
@ -59,10 +58,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *
kind = 0; kind = 0;
} }
strcpy(name, names[kind]); snprintf(name, sizeof(name), "%s%d", names[kind], counters[kind]);
for (ptr = name; *ptr; ptr++);
*ptr++ = counters[kind] + '0';
*ptr++ = '\0';
counters[kind]++; counters[kind]++;
/* Device (LCD0) */ /* Device (LCD0) */