File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -323,18 +323,29 @@ static const struct dfs_file_ops pipe_fops =
323323rt_err_t rt_pipe_open (rt_device_t device , rt_uint16_t oflag )
324324{
325325 rt_pipe_t * pipe = (rt_pipe_t * )device ;
326+ rt_err_t ret = RT_EOK ;
326327
327- if (device == RT_NULL ) return - RT_EINVAL ;
328+ if (device == RT_NULL )
329+ {
330+ ret = - RT_EINVAL ;
331+ goto __exit ;
332+ }
333+
328334 rt_mutex_take (& (pipe -> lock ), RT_WAITING_FOREVER );
329335
330336 if (pipe -> fifo == RT_NULL )
331337 {
332338 pipe -> fifo = rt_ringbuffer_create (pipe -> bufsz );
339+ if (pipe -> fifo == RT_NULL )
340+ {
341+ ret = - RT_ENOMEM ;
342+ }
333343 }
334344
335345 rt_mutex_release (& (pipe -> lock ));
336346
337- return RT_EOK ;
347+ __exit :
348+ return ret ;
338349}
339350
340351rt_err_t rt_pipe_close (rt_device_t device )
You can’t perform that action at this time.
0 commit comments