File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -323,23 +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 );
333339 if (pipe -> fifo == RT_NULL )
334340 {
335- rt_mutex_release (& (pipe -> lock ));
336- return - RT_ENOMEM ;
341+ ret = - RT_ENOMEM ;
337342 }
338343 }
339344
340345 rt_mutex_release (& (pipe -> lock ));
341346
342- return RT_EOK ;
347+ __exit :
348+ return ret ;
343349}
344350
345351rt_err_t rt_pipe_close (rt_device_t device )
You can’t perform that action at this time.
0 commit comments