Donny9 commented on a change in pull request #2315:
URL: https://github.com/apache/incubator-nuttx/pull/2315#discussion_r525750183



##########
File path: drivers/sensors/sensor.c
##########
@@ -801,9 +654,9 @@ int sensor_register(FAR struct sensor_lowerhalf_s *lower, 
int devno)
 
   /* Initialize sensor buffer */
 
-  ret = sensor_buffer_create(&upper->buffer,
-                             lower->type, lower->buffer_size);
-  if (ret)
+  bytes = ROUNDUP(lower->buffer_size, g_sensor_info[lower->type].esize);

Review comment:
       When fetch is NULL, the lower->buffer_size is zero, and 
ROUNDUP(lower->buffer_size,...) also is zero, so circ_buffer_init will not 
alloc buffer space for sensor using fetch api. This ensures code consistency 
between not fetch and use fetch.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to