[PATCH] staging: asus_oled: Fix bug in asus_oled where 0 is not acted upon

Sean Paul seanpaul at chromium.org
Thu Jan 19 01:20:41 UTC 2012


On Wed, Jan 18, 2012 at 12:00 PM, Sean Paul <seanpaul at chromium.org> wrote:
> Fixes a bug in the asus_oled driver where values of '0' and ' ' are ignored in
> append_values. The bug was introduced in commit 1ff12a4aa.
>
> Signed-off-by: Sean Paul <seanpaul at chromium.org>
> ---
>  drivers/staging/asus_oled/asus_oled.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
> index e77e4e0..96ce29e 100644
> --- a/drivers/staging/asus_oled/asus_oled.c
> +++ b/drivers/staging/asus_oled/asus_oled.c
> @@ -355,7 +355,13 @@ static void send_data(struct asus_oled_dev *odev)
>
>  static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count)
>  {
> -       while (count-- > 0 && val) {
> +       if (!val) {
> +               odev->last_val = val;
> +               odev->buf_offs += count;
> +               return 0;
> +       }
> +
> +       while (count-- > 0) {
>                size_t x = odev->buf_offs % odev->width;
>                size_t y = odev->buf_offs / odev->width;
>                size_t i;
> @@ -534,7 +540,7 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev,
>                        return -ENOMEM;
>                }
>
> -               memset(odev->buf, 0xff, odev->buf_size);
> +               memset(odev->buf, 0x00, odev->buf_size);

This is a bug, I'm sending a patch to remove this chunk.

>
>                odev->buf_offs = 0;
>                odev->width = w;
> --
> 1.7.7.3
>



More information about the devel mailing list