summaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorguo <[email protected]>2023-05-16 18:46:42 +0800
committerGitHub <[email protected]>2023-05-16 18:46:42 +0800
commit12a4bb154a21c5628fb6c81986b595f93bcf02ea (patch)
tree16a7aedcdfaa2e9c0470d92185c919ad7134ceec /src/device.c
parentde567b8fb3c85de7b1fe496a696e82a2a2b57a1d (diff)
[kernel] fix device_open oflag comparison error. (#7512)
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index 957d41551c..47482b50d3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -235,7 +235,7 @@ rt_err_t rt_device_open(rt_device_t dev, rt_uint16_t oflag)
/* device is not opened or opened by other oflag, call device_open interface */
if (!(dev->open_flag & RT_DEVICE_OFLAG_OPEN) ||
- ((dev->open_flag & RT_DEVICE_OFLAG_MASK) | (oflag & RT_DEVICE_OFLAG_MASK)))
+ ((dev->open_flag & RT_DEVICE_OFLAG_MASK) != (oflag & RT_DEVICE_OFLAG_MASK)))
{
if (device_open != RT_NULL)
{