Commit 2505aa6ce42a686b2d3db95ccdcc7bc100e7b8c0
Committed by
Greg Kroah-Hartman
1 parent
0a2cc4977f
Exists in
master
and in
6 other branches
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>
Showing 1 changed file with 5 additions and 1 deletions Side-by-side Diff
drivers/staging/bcm/Bcmchar.c
... | ... | @@ -205,6 +205,7 @@ |
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))) |
... | ... | @@ -221,7 +222,10 @@ |
221 | 222 | return -EINVAL; |
222 | 223 | } |
223 | 224 | |
224 | - Bufflen = IoBuffer.OutputLength + (4 - IoBuffer.OutputLength%4)%4; | |
225 | + Bufflen = IoBuffer.OutputLength; | |
226 | + temp_value = 4 - (Bufflen % 4); | |
227 | + Bufflen += temp_value % 4; | |
228 | + | |
225 | 229 | temp_buff = kmalloc(Bufflen, GFP_KERNEL); |
226 | 230 | if (!temp_buff) |
227 | 231 | return -ENOMEM; |