4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-30 06:40:25 +08:00

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.
This commit is contained in:
Grissiom 2013-08-22 15:12:00 +08:00
parent b4ba2657bb
commit 824261d3bc

View File

@ -53,6 +53,9 @@ static rt_err_t _portal_open(rt_device_t dev, rt_uint16_t oflag)
RT_ASSERT(dev);
if (!oflag)
return -RT_ERROR;
portal = (struct rt_portal_device*)dev;
if (oflag & RT_DEVICE_OFLAG_RDONLY)