Skip to content

Commit

Permalink
gma500@ Fix backlight range error
Browse files Browse the repository at this point in the history
If we go out of range we break the pm counts on the error path

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Alan Cox authored and Greg Kroah-Hartman committed Jul 15, 2011
1 parent f642062 commit 83c871e
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/staging/gma500/mrst_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,12 @@ static int device_backlight_init(struct drm_device *dev)
value /= bl_max_freq;
value /= blc_pwm_precision_factor;

if (value > (unsigned long long)MRST_BLC_MAX_PWM_REG_FREQ)
return -ERANGE;

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)));
REG_WRITE(BLC_PWM_CTL, value | (value << 16));
}
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;
Expand Down

0 comments on commit 83c871e

Please sign in to comment.