From 12a4bb154a21c5628fb6c81986b595f93bcf02ea Mon Sep 17 00:00:00 2001 From: guo Date: Tue, 16 May 2023 18:46:42 +0800 Subject: [PATCH] [kernel] fix device_open oflag comparison error. (#7512) --- src/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {