Explorar o código

[kernel] fix device_open oflag comparison error. (#7512)

guo %!s(int64=2) %!d(string=hai) anos
pai
achega
12a4bb154a
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/device.c

+ 1 - 1
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)
         {