rtems_set_errno_and_return_minus_one in driver not returning correct value

Chris Johns chrisj at rtems.org
Sun Aug 23 23:19:10 UTC 2015


On 21/08/2015 10:22 pm, Inderjit Singh wrote:
> Hi,
> 
> In my RTEMS driver I set and return error value by following macro:
> 
> rtems_set_errno_and_return_minus_one(EALREADY);
> 
> But in my rtems app when I print the error out by:
> 
> fd = open(RTEMS_SYSFLASH_DEVICE_NAME, O_RDWR);
> if(fd < 0) {
>   printk("Couldn't Open device (%d:%d:%s).", fd, errno, strerror(errno));
>   exit(-1);
> }
> 
> *OUTPUT:* Couldn't Open device (-1:22:Invalid argument).
> 
> No matter what errno value i set I always get the same (22: Invalid
> argument). I don't understand why. Any help would be appreciated.
> 

Are you sure the driver is correctly installed and registered and
reaching your code ? Maybe some other part of the file system is
detecting an error and returning the error code you are seeing for some
other reason. I would add a print statement where you set the error code
to see if that code is being reached.

Chris



More information about the devel mailing list