Skip to content

Commit 3cf5c3c

Browse files
finikorgcarlescufi
authored andcommitted
lib: ring_buf: Make code consistent
Make code easier to read by using the same name for error code. Signed-off-by: Andrei Emeltchenko <[email protected]>
1 parent e63eedc commit 3cf5c3c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/os/ring_buffer.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,16 +189,16 @@ int ring_buf_item_put(struct ring_buf *buf, uint16_t type, uint8_t value,
189189
uint8_t *dst, *data = (uint8_t *)data32;
190190
struct ring_element *header;
191191
uint32_t space, size, partial_size, total_size;
192-
int ret;
192+
int err;
193193

194194
space = ring_buf_space_get(buf);
195195
size = size32 * 4;
196196
if (size + sizeof(struct ring_element) > space) {
197197
return -EMSGSIZE;
198198
}
199199

200-
ret = ring_buf_put_claim(buf, &dst, sizeof(struct ring_element));
201-
__ASSERT_NO_MSG(ret == sizeof(struct ring_element));
200+
err = ring_buf_put_claim(buf, &dst, sizeof(struct ring_element));
201+
__ASSERT_NO_MSG(err == sizeof(struct ring_element));
202202

203203
header = (struct ring_element *)dst;
204204
header->type = type;
@@ -215,9 +215,9 @@ int ring_buf_item_put(struct ring_buf *buf, uint16_t type, uint8_t value,
215215
} while (size && partial_size);
216216
__ASSERT_NO_MSG(size == 0);
217217

218-
ret = ring_buf_put_finish(buf, total_size);
219-
__ASSERT_NO_MSG(ret == 0);
220-
ARG_UNUSED(ret);
218+
err = ring_buf_put_finish(buf, total_size);
219+
__ASSERT_NO_MSG(err == 0);
220+
ARG_UNUSED(err);
221221

222222
return 0;
223223
}
@@ -228,14 +228,14 @@ int ring_buf_item_get(struct ring_buf *buf, uint16_t *type, uint8_t *value,
228228
uint8_t *src, *data = (uint8_t *)data32;
229229
struct ring_element *header;
230230
uint32_t size, partial_size, total_size;
231-
int ret;
231+
int err;
232232

233233
if (ring_buf_is_empty(buf)) {
234234
return -EAGAIN;
235235
}
236236

237-
ret = ring_buf_get_claim(buf, &src, sizeof(struct ring_element));
238-
__ASSERT_NO_MSG(ret == sizeof(struct ring_element));
237+
err = ring_buf_get_claim(buf, &src, sizeof(struct ring_element));
238+
__ASSERT_NO_MSG(err == sizeof(struct ring_element));
239239

240240
header = (struct ring_element *)src;
241241

@@ -262,9 +262,9 @@ int ring_buf_item_get(struct ring_buf *buf, uint16_t *type, uint8_t *value,
262262
size -= partial_size;
263263
} while (size && partial_size);
264264

265-
ret = ring_buf_get_finish(buf, total_size);
266-
__ASSERT_NO_MSG(ret == 0);
267-
ARG_UNUSED(ret);
265+
err = ring_buf_get_finish(buf, total_size);
266+
__ASSERT_NO_MSG(err == 0);
267+
ARG_UNUSED(err);
268268

269269
return 0;
270270
}

0 commit comments

Comments
 (0)