Commit 83c871ee authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman
Browse files

gma500@ Fix backlight range error



If we go out of range we break the pm counts on the error path

Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f642062f
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -157,14 +157,12 @@ static int device_backlight_init(struct drm_device *dev)
	value /= bl_max_freq;
	value /= blc_pwm_precision_factor;

	if (gma_power_begin(dev, false)) {
	if (value > (unsigned long long)MRST_BLC_MAX_PWM_REG_FREQ)
			return -ERANGE;
		else {
			REG_WRITE(BLC_PWM_CTL2,
					(0x80000000 | REG_READ(BLC_PWM_CTL2)));

	if (gma_power_begin(dev, false)) {
		REG_WRITE(BLC_PWM_CTL2, (0x80000000 | REG_READ(BLC_PWM_CTL2)));
		REG_WRITE(BLC_PWM_CTL, value | (value << 16));
		}
		gma_power_end(dev);
	}
	return 0;