From 42ebd01014d94b04e1647edfca4d067d46998b5b Mon Sep 17 00:00:00 2001 From: Daniel Kurtz Date: Thu, 6 Oct 2011 15:43:20 -0700 Subject: [PATCH] --- yaml --- r: 269491 b: refs/heads/master c: 626af8611211c55595cd316103abd2419cd4d861 h: refs/heads/master i: 269489: a6b00a55a49a47df6d609eb52440ea5ee03e3121 269487: 25f5327f2469ca34e00b29369159adc10f525d1d v: v3 --- [refs] | 2 +- .../drivers/input/touchscreen/atmel_mxt_ts.c | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index fb935a59f8dd..08adca1b9753 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 04c59abd3c053f9a42437d5db3af4383cf68659c +refs/heads/master: 626af8611211c55595cd316103abd2419cd4d861 diff --git a/trunk/drivers/input/touchscreen/atmel_mxt_ts.c b/trunk/drivers/input/touchscreen/atmel_mxt_ts.c index f5d66859f232..a596c2775d1a 100644 --- a/trunk/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/trunk/drivers/input/touchscreen/atmel_mxt_ts.c @@ -910,12 +910,17 @@ static ssize_t mxt_object_show(struct device *dev, for (i = 0; i < data->info.object_num; i++) { object = data->object_table + i; - count += sprintf(buf + count, - "Object Table Element %d(Type %d)\n", + count += snprintf(buf + count, PAGE_SIZE - count, + "Object[%d] (Type %d)\n", i + 1, object->type); + if (count >= PAGE_SIZE) + return PAGE_SIZE - 1; if (!mxt_object_readable(object->type)) { - count += sprintf(buf + count, "\n"); + count += snprintf(buf + count, PAGE_SIZE - count, + "\n"); + if (count >= PAGE_SIZE) + return PAGE_SIZE - 1; continue; } @@ -925,11 +930,15 @@ static ssize_t mxt_object_show(struct device *dev, if (error) return error; - count += sprintf(buf + count, - " Byte %d: 0x%x (%d)\n", j, val, val); + count += snprintf(buf + count, PAGE_SIZE - count, + "\t[%2d]: %02x (%d)\n", j, val, val); + if (count >= PAGE_SIZE) + return PAGE_SIZE - 1; } - count += sprintf(buf + count, "\n"); + count += snprintf(buf + count, PAGE_SIZE - count, "\n"); + if (count >= PAGE_SIZE) + return PAGE_SIZE - 1; } return count;