[PATCH] atmel_lcdfb: fix negative check on unsigned - Kernel

This is a discussion on [PATCH] atmel_lcdfb: fix negative check on unsigned - Kernel ; No signed negative values will get noticed Signed-off-by: Roel Kluin --- 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 / ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: [PATCH] atmel_lcdfb: fix negative check on unsigned

  1. [PATCH] atmel_lcdfb: fix negative check on unsigned

    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);
    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",
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

  2. Re: [PATCH] atmel_lcdfb: fix negative check on unsigned

    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
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

+ Reply to Thread