summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2020-03-21 18:52:14 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-03-24 16:46:32 +0000
commitc0be4107606c4aeb41fb238a5ef31339b27e5da0 (patch)
tree3822609a22ffd71ec57ffcc61c8c983ca7695fda /src
parent53c1717dc139e9256294c73b2e8a45dd8de08835 (diff)
downloadcoreboot-c0be4107606c4aeb41fb238a5ef31339b27e5da0.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/drivers/intel/gma/acpi.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/drivers/intel/gma/acpi.c b/src/drivers/intel/gma/acpi.c
index ff4372f610..3ec8527e6f 100644
--- a/src/drivers/intel/gma/acpi.c
+++ b/src/drivers/intel/gma/acpi.c
@@ -50,8 +50,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *
acpigen_pop_len(); /* End Method. */
for (i = 0; i < conf->ndid; i++) {
- char name[10];
- char *ptr;
+ char name[5];
int kind;
kind = (conf->did[i] >> 8) & 0xf;
@@ -59,10 +58,7 @@ drivers_intel_gma_displays_ssdt_generate(const struct i915_gpu_controller_info *
kind = 0;
}
- strcpy(name, names[kind]);
- for (ptr = name; *ptr; ptr++);
- *ptr++ = counters[kind] + '0';
- *ptr++ = '\0';
+ snprintf(name, sizeof(name), "%s%d", names[kind], counters[kind]);
counters[kind]++;
/* Device (LCD0) */