[PATCH v2] input: synaptics-rmi4 - use snprintf instead of sprintf in rmi_i2c.c

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

 



This is a trivial change to replace the sprintf loop with snprintf using
up-to-date format capability.

Signed-off-by: Christopher Heiny <cheiny@xxxxxxxxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Cc: Benjamin Tissoires <benjamin.tissoires@xxxxxxxxxx>

---

 drivers/input/rmi4/rmi_i2c.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/input/rmi4/rmi_i2c.c b/drivers/input/rmi4/rmi_i2c.c
index d94114b..8a93dad 100644
--- a/drivers/input/rmi4/rmi_i2c.c
+++ b/drivers/input/rmi4/rmi_i2c.c
@@ -138,9 +138,6 @@ static int rmi_set_page(struct rmi_transport_dev *xport, u8 page)
 
 static int copy_to_debug_buf(struct device *dev, struct rmi_i2c_data *data,
 			     const u8 *buf, const int len) {
-	int i;
-	int n = 0;
-	char *temp;
 	int dbg_size = 3 * len + 1;
 
 	if (!data->debug_buf || data->debug_buf_size < dbg_size) {
@@ -154,12 +151,8 @@ static int copy_to_debug_buf(struct device *dev, struct rmi_i2c_data *data,
 			return -ENOMEM;
 		}
 	}
-	temp = data->debug_buf;
 
-	for (i = 0; i < len; i++) {
-		n = sprintf(temp, " %02x", buf[i]);
-		temp += n;
-	}
+	snprintf(data->debug_buf, data->debug_buf_size, "%*ph", len, buf);
 
 	return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux