From 6dc488a6781e4b0ecd0d4cb963d40709f17df0ef Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Fri, 28 Feb 2020 10:38:55 +0100 Subject: drivers/intel/gma/acpi: Prevent DivideByZero error In case backlight control isn't enabled BCLM is zero. Return early instead of running into a DivideByZero error. This happens on devices that don't have backlight control, like desktops and servers. The proper fix is to not include those ACPI methods, but that requires a much bigger refactoring. Change-Id: Ie9bdb00949d6d44fd99321db556d6008d2d12a7f Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/c/coreboot/+/39158 Tested-by: build bot (Jenkins) Reviewed-by: Angel Pons --- src/drivers/intel/gma/acpi/configure_brightness_levels.asl | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/drivers/intel/gma') diff --git a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl index 3ec74119f1..21f0b2318e 100644 --- a/src/drivers/intel/gma/acpi/configure_brightness_levels.asl +++ b/src/drivers/intel/gma/acpi/configure_brightness_levels.asl @@ -122,6 +122,11 @@ /* Find value closest to BCLV in BRIG (which must be ordered) */ Method (XBQC, 0, NotSerialized) { + /* Prevent DivideByZero if backlight control isn't enabled */ + If (BCLM == 0) + { + Return (Zero) + } /* Local0: current percentage */ Store (DRCL (Multiply (BCLV, 100), BCLM), Local0) -- cgit v1.2.3