提交 824261d3 编写于 作者: G Grissiom

dev/portal: add checks on oflag

It does not make sense to open portal without a flag. One should open a
portal with RT_DEVICE_OFLAG_RDWR in most cases.
上级 b4ba2657
...@@ -53,6 +53,9 @@ static rt_err_t _portal_open(rt_device_t dev, rt_uint16_t oflag) ...@@ -53,6 +53,9 @@ static rt_err_t _portal_open(rt_device_t dev, rt_uint16_t oflag)
RT_ASSERT(dev); RT_ASSERT(dev);
if (!oflag)
return -RT_ERROR;
portal = (struct rt_portal_device*)dev; portal = (struct rt_portal_device*)dev;
if (oflag & RT_DEVICE_OFLAG_RDONLY) if (oflag & RT_DEVICE_OFLAG_RDONLY)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册