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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
---
 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);
 
 		odev->buf_offs = 0;
 		odev->width = w;
-- 
1.7.7.3

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux