summaryrefslogtreecommitdiffstats
path: root/drivers/staging/gma500
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2011-07-15 17:35:12 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-07-15 19:05:08 +0200
commit83c871ee2b60619d74d03eaf6f75a7d9c3cb0e45 (patch)
treee3138432e8b47d8645213a9b29b8f6f3d363da92 /drivers/staging/gma500
parentf642062fc7a6bebdd857408e7a9f678bfd2e4004 (diff)
downloadblackbird-op-linux-83c871ee2b60619d74d03eaf6f75a7d9c3cb0e45.tar.gz
blackbird-op-linux-83c871ee2b60619d74d03eaf6f75a7d9c3cb0e45.zip
gma500@ Fix backlight range error
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>
Diffstat (limited to 'drivers/staging/gma500')
-rw-r--r--drivers/staging/gma500/mrst_device.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/gma500/mrst_device.c b/drivers/staging/gma500/mrst_device.c
index 573142f13f83..6707fafbfa1e 100644
--- a/drivers/staging/gma500/mrst_device.c
+++ b/drivers/staging/gma500/mrst_device.c
@@ -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;
OpenPOWER on IntegriCloud