samples/logger-hook: fix ring buffer usage and initialize variables.

1. Fix ring buffer usage according to suggestion in ZEP-1449
2. Redo fix variable initialization for CID 157609

Jira: ZEP-1449

Change-Id: Icce055940f4f82f3d87898f53cfbcae1fe73162c
Signed-off-by: Yossi Havusha <yossi.havusha@intel.com>
This commit is contained in:
Yossi Havusha 2016-12-18 14:22:25 +02:00 committed by Anas Nashif
parent f655da2b5e
commit bdd2e0145c

View File

@ -86,11 +86,12 @@ void main(void)
static inline void ring_buf_print(struct ring_buf *buf)
{
uint8_t size;
uint8_t data[512];
int ret = EAGAIN, count = 0;
int ret = 1;
int count = 0;
uint8_t size = 0;
while (ret == EAGAIN && count < 2) {
while (ret != 0 && count < 2) {
count++;
ret = sys_ring_buf_get(&log_cbuffer.ring_buffer, 0, 0,
(uint32_t *)data, &size);