public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Ben Dooks <ben-linux@fluff.org>
Cc: linux-kernel@vger.kernel.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	stable@kernel.org
Subject: [PATCH 2.6.33] s3c-fb: Fix handling of missing refresh in platform data
Date: Wed, 13 Jan 2010 16:16:42 +0000	[thread overview]
Message-ID: <1263399402-5912-1-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)

Commit 600ce1a0faafeed1ce6bcfd421bc040b941cbbc1 ("fix clock setting
for Samsung SoC Framebuffer") introduced a mandatory refresh parameter
to the platform data for the S3C framebuffer but did not introduce any
validation code, causing existing platforms to divide by zero whenever
the framebuffer is configured, generating warnings and unusable output.

Add a WARN_ON(), in line with similar parameters, and check that we
have a non-zero refresh before we dividing by it. This gets usable
output on at least the SMDK6410, though without specifying a refresh
we see visible issues on some boots.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@kernel.org
---

All mainline users of the s3c-fb driver are affected by this, none
provide refresh.

 drivers/video/s3c-fb.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index adf9632..0f2e8f6 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -224,7 +224,8 @@ static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int
 	unsigned long clk = clk_get_rate(sfb->bus_clk);
 	unsigned int result;
 
-	pixclk *= win->win_mode.refresh;
+	if (win->win_mode.refresh)
+		pixclk *= win->win_mode.refresh;
 	result = clk / pixclk;
 
 	dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n",
@@ -766,6 +767,7 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no,
 	WARN_ON(windata->max_bpp == 0);
 	WARN_ON(windata->win_mode.xres == 0);
 	WARN_ON(windata->win_mode.yres == 0);
+	WARN_ON(windata->win_mode.refresh == 0);
 
 	win = fbinfo->par;
 	var = &fbinfo->var;
-- 
1.6.6


             reply	other threads:[~2010-01-13 16:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13 16:16 Mark Brown [this message]
2010-01-14  7:36 ` [PATCH 2.6.33] s3c-fb: Fix handling of missing refresh in platform data Ben Dooks
2010-01-14 10:20   ` Mark Brown
2010-01-14 10:26     ` [PATCH 2.6.33] s3c-fb: Fix divide by zero and broken output Mark Brown
2010-01-14 23:06       ` Andrew Morton
2010-01-15  0:01         ` Mark Brown
2010-01-15  0:16           ` Mark Brown

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=1263399402-5912-1-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=akpm@linux-foundation.org \
    --cc=ben-linux@fluff.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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