You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/06/05 02:16:58 UTC

[GitHub] [incubator-nuttx] masayuki2009 commented on a change in pull request #1196: Refactor audio

masayuki2009 commented on a change in pull request #1196:
URL: https://github.com/apache/incubator-nuttx/pull/1196#discussion_r435653888



##########
File path: drivers/audio/audio_null.c
##########
@@ -771,11 +772,12 @@ static int null_ioctl(FAR struct audio_lowerhalf_s *dev, int cmd,
 #endif
 
       default:
+        ret = -EINVAL;

Review comment:
       > This NuttX convention is that if the ioctl functions does not recognize the command, it returns ENOTTY, not EINVAL.
   > 
   > See https://en.wikipedia.org/wiki/Not_a_typewriter which is how NutX does things in ioctls too.
   
   Hi @patacongo,
   
   Thanks for the comments. 
   Actually, I checked it with 'man ioctl' on Ubuntu18.04 and it says that
   
   ```
   ERRORS
          EBADF  fd is not a valid file descriptor.
          EFAULT argp references an inaccessible memory area.
          EINVAL request or argp is not valid.
          ENOTTY fd is not associated with a character special device.
          ENOTTY The specified request does not apply to the kind of object that the file descriptor fd references.
   ```
   
   So I thought we should return EINVAL.
   However in NuttX should we return ENOTTY instead of EINVAL?
   




----------------------------------------------------------------
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:
users@infra.apache.org