Skip to content

Commit 3bb8edf

Browse files
author
Han Xinrong
committed
error check of rt_event_recv()
add error check
1 parent 3f122bd commit 3bb8edf

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

bsp/nrf5x/libraries/templates/nrf52x/applications/ble_nus_app.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,11 @@ static void _stack_thread(void *parameter)
599599
{
600600
rt_uint32_t event = 0;
601601
rt_tick_t dispatch_timeout = RT_WAITING_NO;
602+
rt_err_t result;
602603

603-
rt_event_recv(stack_event, STACK_EV_DISCON | STACK_EV_DISPATCH | STACK_EV_KEY,
604+
result = rt_event_recv(stack_event, STACK_EV_DISCON | STACK_EV_DISPATCH | STACK_EV_KEY,
604605
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR, next_timeout, &event);
606+
RT_ASSERT(result == RT_EOK);
605607

606608
if (evt_dispatch_worker() != RT_EOK)
607609
{

components/dfs/filesystems/jffs2/src/gcthread.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
187187
{
188188
struct super_block *sb=OFNI_BS_2SFFJ(c);
189189
cyg_mtab_entry *mte;
190-
rt_uint32_t e;
190+
rt_uint32_t e;
191+
rt_err_t result;
191192

192193
//RT_ASSERT(sb->s_gc_thread_handle);
193194

@@ -198,10 +199,11 @@ jffs2_stop_garbage_collect_thread(struct jffs2_sb_info *c)
198199

199200
D1(printk("jffs2_stop_garbage_collect_thread wait\n"));
200201

201-
rt_event_recv(&sb->s_gc_thread_flags,
202+
result = rt_event_recv(&sb->s_gc_thread_flags,
202203
GC_THREAD_FLAG_HAS_EXIT,
203204
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
204205
RT_WAITING_FOREVER, &e);
206+
RT_ASSERT(result == RT_EOK);
205207

206208
// Kill and free the resources ... this is safe due to the flag
207209
// from the thread.
@@ -218,15 +220,17 @@ jffs2_garbage_collect_thread(unsigned long data)
218220
struct super_block *sb=OFNI_BS_2SFFJ(c);
219221
cyg_mtab_entry *mte;
220222
rt_uint32_t flag = 0;
223+
rt_err_t result;
221224

222225
D1(printk("jffs2_garbage_collect_thread START\n"));
223226

224227
while(1) {
225-
rt_event_recv(&sb->s_gc_thread_flags,
228+
result = rt_event_recv(&sb->s_gc_thread_flags,
226229
GC_THREAD_FLAG_TRIG | GC_THREAD_FLAG_STOP,
227230
RT_EVENT_FLAG_OR | RT_EVENT_FLAG_CLEAR,
228231
cyg_current_time() + CYGNUM_JFFS2_GS_THREAD_TICKS,
229232
&flag);
233+
RT_ASSERT(result == RT_EOK);
230234

231235
if (flag & GC_THREAD_FLAG_STOP)
232236
break;

0 commit comments

Comments
 (0)