rtems_set_errno_and_return_minus_one in driver not returning correct value

Inderjit Singh inderjit.singh at aacmicrotec.com
Mon Aug 24 07:08:13 UTC 2015


Hi Chris,

I am pretty sure the driver is working fine yes. I had this issue for some time and ignored the error messages during development as I always get a negative value. Now the driver is working is as it should and I am enforcing the error to test this.

Regards,
Indy
________________________________________
From: Chris Johns [chrisj at rtems.org]
Sent: 24 August 2015 01:19
To: Inderjit Singh; devel at rtems.org
Subject: Re: rtems_set_errno_and_return_minus_one in driver not returning correct value

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