linguini1 opened a new issue, #15787:
URL: https://github.com/apache/nuttx/issues/15787

   ### Description / Steps to reproduce the issue
   
   When a driver-level implementation of the `selftest` function returns a 0 
(`OK`) error code, the uORB framework hangs indefinitely.
   
   Steps to reproduce:
   - Create a stub for the `selftest` function
   - Return a negated error code from the selftest function unconditionally
   - Call self-test through application layer using `orb_ioctl(fd, 
SNIOC_SELFTEST, 0)`
   - Observe failure with return of -1
   - Change lower half `selftest` to return 0
   - Observe application layer call hangs indefinitely
   
   I observed this issue while writing a self-test function for the LSM6DSO32 
IMU. When the selftest fails everything is fine, but when it passes the 
function hangs forever. I was able to confirm this by adding a log statement at 
the exit point and changing the return code to `-EACCESS` before the function 
returns. The log statement gets executed and the function does not hang. It 
does hang if I remove the error code change code and allow the function to 
return 0.
   
   ```c
   /* Other code above ...*/
   early_ret:
     nxmutex_unlock(&dev->devlock);
     /* This gets printed and -1 shown by orb_ioctl when returning -EACCES */
     sninfo("Finished selftest");
     return -EACCES;
     /* Commenting out the above line and replacing with 'return 0' results in 
hang */
   ```
   
   On a side note, `orb_ioctl(fd, SNIOC_RESET, 0)` returning -1 regardless of 
the error returned by the lowerhalf function is not documented anywhere I could 
find. I feel it should return a positive error code indicating the error that 
occurred, like `ioctl` does.
   
   ### On which OS does this issue occur?
   
   [OS: Linux]
   
   ### What is the version of your OS?
   
   Linux 6.13.1-arch1-1 #1 SMP PREEMPT_DYNAMIC GNU/Linux
   
   ### NuttX Version
   
   master
   
   ### Issue Architecture
   
   [Arch: arm]
   
   ### Issue Area
   
   [Area: OS Components]
   
   ### Host information
   
   _No response_
   
   ### Verification
   
   - [x] I have verified before submitting the report.


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

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

Reply via email to