From fc8cd5ea4c72890c652a5c1c5d83cd5eb62f99d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Thu, 30 Oct 2008 13:56:47 +0200 Subject: [PATCH] --- yaml --- r: 127221 b: refs/heads/master c: 857cc4dfb6420ec0a67b3cda559aaa7c429ddce7 h: refs/heads/master i: 127219: 38fba2bd566af749bc7ee857be0fc34f820415a3 v: v3 --- [refs] | 2 +- trunk/drivers/usb/class/usbtmc.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 42987c7ca29c..bed2957624df 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b404299f6bfdf5aa7315e521b570e33f082b2f9e +refs/heads/master: 857cc4dfb6420ec0a67b3cda559aaa7c429ddce7 diff --git a/trunk/drivers/usb/class/usbtmc.c b/trunk/drivers/usb/class/usbtmc.c index 43a863c5cc43..0f5c05f6f9df 100644 --- a/trunk/drivers/usb/class/usbtmc.c +++ b/trunk/drivers/usb/class/usbtmc.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -482,7 +483,6 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf, int retval; int actual; unsigned long int n_bytes; - int n; int remaining; int done; int this_part; @@ -526,11 +526,8 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf, goto exit; } - n_bytes = 12 + this_part; - if (this_part % 4) - n_bytes += 4 - this_part % 4; - for (n = 12 + this_part; n < n_bytes; n++) - buffer[n] = 0; + n_bytes = roundup(12 + this_part, 4); + memset(buffer + 12 + this_part, 0, n_bytes - (12 + this_part)); retval = usb_bulk_msg(data->usb_dev, usb_sndbulkpipe(data->usb_dev,