summaryrefslogtreecommitdiff
path: root/drivers/staging/bcm
diff options
context:
space:
mode:
authorKevin McKinney <klmckinney1@gmail.com>2011-09-28 01:28:11 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-30 00:34:51 (GMT)
commit2505aa6ce42a686b2d3db95ccdcc7bc100e7b8c0 (patch)
tree8c0b7a4aaac9d1316ccc9036559545700708785e /drivers/staging/bcm
parent0a2cc4977ffd551b58ae20c646bd7083ba5a89d2 (diff)
downloadlinux-fsl-qoriq-2505aa6ce42a686b2d3db95ccdcc7bc100e7b8c0.tar.xz
Staging: bcm: Alter LOC for readability/understandability purposes
This patch alters a line of code to make it more readable and easier to understand. The purpose of the original line of code was to compute the amount of memory to request from kmalloc. This mulit-step algorithm was being done in one line of code, thus making it more difficult to understand. Therefore, I split this algorithm into three logical steps. Signed-off-by: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/bcm')
-rw-r--r--drivers/staging/bcm/Bcmchar.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/staging/bcm/Bcmchar.c b/drivers/staging/bcm/Bcmchar.c
index 867c65c..2fa658e 100644
--- a/drivers/staging/bcm/Bcmchar.c
+++ b/drivers/staging/bcm/Bcmchar.c
@@ -205,6 +205,7 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
RDM_BUFFER sRdmBuffer = {0};
PCHAR temp_buff;
UINT Bufflen;
+ u16 temp_value;
/* Copy Ioctl Buffer structure */
if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER)))
@@ -221,7 +222,10 @@ static long bcm_char_ioctl(struct file *filp, UINT cmd, ULONG arg)
return -EINVAL;
}
- Bufflen = IoBuffer.OutputLength + (4 - IoBuffer.OutputLength%4)%4;
+ Bufflen = IoBuffer.OutputLength;
+ temp_value = 4 - (Bufflen % 4);
+ Bufflen += temp_value % 4;
+
temp_buff = kmalloc(Bufflen, GFP_KERNEL);
if (!temp_buff)
return -ENOMEM;