Browse Source

[sensor] Fixed error with mutex_lock take and release not matching.| 修复锁的获取和释放不对应的错误.

guozhanxin 6 năm trước cách đây
mục cha
commit
8ade4fff2e
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      components/drivers/sensors/sensor.c

+ 5 - 0
components/drivers/sensors/sensor.c

@@ -195,6 +195,11 @@ static rt_err_t rt_sensor_open(rt_device_t dev, rt_uint16_t oflag)
     }
     else
     {
+        if (sensor->module)
+        {
+            /* release the module mutex */
+            rt_mutex_release(sensor->module->lock);
+        }
         return -RT_EINVAL;
     }