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 <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39158
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
This commit is contained in:
Patrick Rudolph 2020-02-28 10:38:55 +01:00 committed by Patrick Georgi
parent a02f00e5d6
commit 6dc488a678
1 changed files with 5 additions and 0 deletions

View File

@ -122,6 +122,11 @@
/* Find value closest to BCLV in BRIG (which must be ordered) */ /* Find value closest to BCLV in BRIG (which must be ordered) */
Method (XBQC, 0, NotSerialized) Method (XBQC, 0, NotSerialized)
{ {
/* Prevent DivideByZero if backlight control isn't enabled */
If (BCLM == 0)
{
Return (Zero)
}
/* Local0: current percentage */ /* Local0: current percentage */
Store (DRCL (Multiply (BCLV, 100), BCLM), Local0) Store (DRCL (Multiply (BCLV, 100), BCLM), Local0)