cport: allocate one buffer for messages
cport: allocate one buffer for messages

A single thread is used to handle receipt of all data sent by the
AP.  That thread is an infinite loop:  allocating a buffer;
receiving data; and passing the buffer to cport_handler().  The
buffer is freed at the end of cport_handler() (though it's currently
leaked if the the data received is shorter than required).

Move the freeing of the buffer out of cport_handler() and into its
caller.  That makes it obvious that there's no need to allocate the
buffer every time through the loop.  Furthermore, since the buffer
has a constant size, we can simply allocate the buffer statically.

For good measure, zero-fill the buffer before receiving the next
message.

Change the do..while loop in cport_thread() to a simple while loop.

Signed-off-by: Alex Elder <f429030cf5c0faf36fac3d102073b6e63a647baa@linaro.org>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@google.com>

bcousson/gbsim,bcousson/gbsim,gregkh/gbsim,gregkh/gbsim,projectara/gbsim,projectara/gbsim,bcousson/gbsim