[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:22:57 UTC 2012


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 |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index e77e4e0..e1bdfcb 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;
-- 
1.7.7.3




More information about the devel mailing list