xiaoxiang781216 commented on a change in pull request #4774:
URL: https://github.com/apache/incubator-nuttx/pull/4774#discussion_r766048429



##########
File path: drivers/ioexpander/gpio.c
##########
@@ -347,8 +349,9 @@ static int gpio_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
           FAR bool *ptr = (FAR bool *)((uintptr_t)arg);
           DEBUGASSERT(ptr != NULL);
 
+          DEBUGASSERT(dev->gp_ops->go_read != NULL);
           ret = dev->gp_ops->go_read(dev, ptr);
-          DEBUGASSERT(ret < 0 || *ptr == 0 || *ptr == 1);

Review comment:
       if ret < 0, we should skip check *ptr equal 0 or 1 since the check is 
meaningless in case of fail,: the driver writer mayn't touch ptr in fail path, 
and then left ptr with a random value.




-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

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


Reply via email to