浏览代码

Merge pull request #2755 from Guozhanxin/sensor_fix

[sensor] Fixed error with mutex_lock take and release not matching.
Bernard Xiong 6 年之前
父节点
当前提交
c8f0ae3f11
共有 1 个文件被更改,包括 5 次插入0 次删除
  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;
     }