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

This commit is contained in:
guo 2023-05-16 18:46:42 +08:00 committed by GitHub
parent de567b8fb3
commit 12a4bb154a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)
{