diff options
| author | Grissiom <[email protected]> | 2013-08-22 15:12:00 +0800 |
|---|---|---|
| committer | Grissiom <[email protected]> | 2013-08-22 15:12:00 +0800 |
| commit | 824261d3bc8467f6220061f43d22321f1ce50bc3 (patch) | |
| tree | 704c5e0d77cbf562e9a8f7b376524be9b31bf231 /components/drivers | |
| parent | b4ba2657bb1e30ff4d658f6d6028a1b8da31e7c0 (diff) | |
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.
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/src/portal.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/components/drivers/src/portal.c b/components/drivers/src/portal.c index 82d9d4e802..26977a8259 100644 --- a/components/drivers/src/portal.c +++ b/components/drivers/src/portal.c @@ -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) |
