public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: greg@kroah.com, linux-kernel@vger.kernel.org
Subject: [PATCH 12/15] gma500@ Fix backlight range error
Date: Fri, 15 Jul 2011 17:35:12 +0100	[thread overview]
Message-ID: <20110715163508.28759.6997.stgit@localhost.localdomain> (raw)
In-Reply-To: <20110715163117.28759.14946.stgit@localhost.localdomain>

From: Alan Cox <alan@linux.intel.com>

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

Signed-off-by: Alan Cox <alan@linux.intel.com>
---

 drivers/staging/gma500/mrst_device.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/gma500/mrst_device.c b/drivers/staging/gma500/mrst_device.c
index 573142f..6707faf 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;


  parent reply	other threads:[~2011-07-15 16:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-15 16:31 [PATCH 01/15] gma500: Cursor interface Alan Cox
2011-07-15 16:32 ` [PATCH 02/15] gma500: Move the 2D operations into DRM Alan Cox
2011-07-15 16:32 ` [PATCH 03/15] gma500: add an mmap ioctl Alan Cox
2011-07-15 16:33 ` [PATCH 04/15] gma500: allow the creation of 'stolen' memory objects Alan Cox
2011-07-15 16:33 ` [PATCH 05/15] gma500: remove the legacy PM method Alan Cox
2011-07-15 16:33 ` [PATCH 06/15] gma500: Make crtc count a property of the device Alan Cox
2011-07-15 16:33 ` [PATCH 07/15] gma500: fix compile warnings when CONFIG_BACKLIGHT_CLASS_DEVICE is not defined Alan Cox
2011-07-15 16:34 ` [PATCH 08/15] gma500: skip getting modes via DDC on Moorestown Alan Cox
2011-07-15 16:34 ` [PATCH 09/15] gma500: Fix cdv warning on unused variable Alan Cox
2011-07-15 16:34 ` [PATCH 10/15] gma500: Add the Oaktrail HDMI support Alan Cox
2011-07-15 16:34 ` [PATCH 11/15] gma500: More Moorestown muddle meddling means MM maybe might modeset Alan Cox
2011-07-15 16:35 ` Alan Cox [this message]
2011-07-15 16:35 ` [PATCH 13/15] gma500: Use the mrst helpers and power control for mode commit Alan Cox
2011-07-15 16:35 ` [PATCH 14/15] gma500: resync with Medfield progress Alan Cox
2011-07-15 16:35 ` [PATCH 15/15] gma500: Clean up the DPU config and make it runtime Alan Cox
2011-07-15 17:06 ` [PATCH 01/15] gma500: Cursor interface Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110715163508.28759.6997.stgit@localhost.localdomain \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox