Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Kevin McKinney and committed by
Greg Kroah-Hartman
2505aa6c 0a2cc497

+5 -1
+5 -1
drivers/staging/bcm/Bcmchar.c
··· 205 205 RDM_BUFFER sRdmBuffer = {0}; 206 206 PCHAR temp_buff; 207 207 UINT Bufflen; 208 + u16 temp_value; 208 209 209 210 /* Copy Ioctl Buffer structure */ 210 211 if (copy_from_user(&IoBuffer, argp, sizeof(IOCTL_BUFFER))) ··· 222 221 return -EINVAL; 223 222 } 224 223 225 - Bufflen = IoBuffer.OutputLength + (4 - IoBuffer.OutputLength%4)%4; 224 + Bufflen = IoBuffer.OutputLength; 225 + temp_value = 4 - (Bufflen % 4); 226 + Bufflen += temp_value % 4; 227 + 226 228 temp_buff = kmalloc(Bufflen, GFP_KERNEL); 227 229 if (!temp_buff) 228 230 return -ENOMEM;