public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: Roel Kluin <12o3l@tiscali.nl>
Cc: lkml <linux-kernel@vger.kernel.org>,
	Nicolas Ferre <nicolas.ferre@atmel.com>
Subject: Re: [PATCH] atmel_lcdfb: fix negative check on unsigned
Date: Fri, 18 Apr 2008 22:34:13 -0400	[thread overview]
Message-ID: <20080418223413.2445b970@siona.local> (raw)
In-Reply-To: <4806D2A0.3080207@tiscali.nl>

Cc'ing the atmel_lcdfb maintainer...

On Thu, 17 Apr 2008 06:31:28 +0200
Roel Kluin <12o3l@tiscali.nl> wrote:

> No signed negative values will get noticed
> 
> Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
> ---
> diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
> index fc65c02..4b927da 100644
> --- a/drivers/video/atmel_lcdfb.c
> +++ b/drivers/video/atmel_lcdfb.c
> @@ -422,13 +422,13 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
>  
>  	value = DIV_ROUND_UP(clk_value_khz, PICOS2KHZ(info->var.pixclock));
>  
> -	value = (value / 2) - 1;
> -	dev_dbg(info->device, "  * programming CLKVAL = 0x%08lx\n", value);
> -
> -	if (value <= 0) {
> +	if ((value / 2) <= 1) {
> +		dev_dbg(info->device, "  * programming CLKVAL = 0x%08lx\n", (value/2)-1);

Makes sense...although I think there's another patch in the queue that
fixes this as well.

>  		dev_notice(info->device, "Bypassing pixel clock divider\n");
>  		lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, ATMEL_LCDC_BYPASS);
>  	} else {
> +		value = (value / 2) - 1;
> +		dev_dbg(info->device, "  * programming CLKVAL = 0x%08lx\n", value);
>  		lcdc_writel(sinfo, ATMEL_LCDC_LCDCON1, value << ATMEL_LCDC_CLKVAL_OFFSET);
>  		info->var.pixclock = KHZ2PICOS(clk_value_khz / (2 * (value + 1)));
>  		dev_dbg(info->device, "  updated pixclk:     %lu KHz\n",

Haavard

      reply	other threads:[~2008-04-19  2:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-17  4:31 [PATCH] atmel_lcdfb: fix negative check on unsigned Roel Kluin
2008-04-19  2:34 ` Haavard Skinnemoen [this message]

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=20080418223413.2445b970@siona.local \
    --to=hskinnemoen@atmel.com \
    --cc=12o3l@tiscali.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicolas.ferre@atmel.com \
    /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