diff options
| author | Meco Jianting Man <[email protected]> | 2021-06-13 16:19:59 +0800 |
|---|---|---|
| committer | Meco Jianting Man <[email protected]> | 2021-06-13 16:19:59 +0800 |
| commit | 4fd407461793613fd2f0fc74f85b194b68df9447 (patch) | |
| tree | 46c71c9be7294a5d9870f83c4f2edb4a28b75729 /components/drivers | |
| parent | fbcaa667f87be5c5a3e1502d12facd24ca5b2234 (diff) | |
| parent | b24447a60a6941568d58dd1ca358951674924ed2 (diff) | |
Merge branch 'RT-Thread:master' into ioctl
Diffstat (limited to 'components/drivers')
| -rw-r--r-- | components/drivers/cputime/cputime.c | 5 | ||||
| -rw-r--r-- | components/drivers/src/pipe.c | 11 |
2 files changed, 9 insertions, 7 deletions
diff --git a/components/drivers/cputime/cputime.c b/components/drivers/cputime/cputime.c index 4a9eee3a71..750733f366 100644 --- a/components/drivers/cputime/cputime.c +++ b/components/drivers/cputime/cputime.c @@ -10,6 +10,7 @@ #include <rtdevice.h> #include <rtthread.h> +#include <sys/errno.h> static const struct rt_clock_cputime_ops *_cputime_ops = RT_NULL; @@ -24,7 +25,7 @@ float clock_cpu_getres(void) if (_cputime_ops) return _cputime_ops->cputime_getres(); - rt_set_errno(-ENOSYS); + rt_set_errno(ENOSYS); return 0; } @@ -38,7 +39,7 @@ uint32_t clock_cpu_gettime(void) if (_cputime_ops) return _cputime_ops->cputime_gettime(); - rt_set_errno(-ENOSYS); + rt_set_errno(ENOSYS); return 0; } diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index 0e35248480..7fa5eb067d 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -11,8 +11,9 @@ #include <rthw.h> #include <rtdevice.h> #include <stdint.h> +#include <sys/errno.h> -#if defined(RT_USING_POSIX) +#ifdef RT_USING_POSIX #include <dfs_file.h> #include <dfs_posix.h> #include <dfs_poll.h> @@ -375,7 +376,7 @@ rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t if (device == RT_NULL) { - rt_set_errno(-EINVAL); + rt_set_errno(EINVAL); return 0; } if (count == 0) return 0; @@ -403,7 +404,7 @@ rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt if (device == RT_NULL) { - rt_set_errno(-EINVAL); + rt_set_errno(EINVAL); return 0; } if (count == 0) return 0; @@ -517,12 +518,12 @@ int rt_pipe_delete(const char *name) } else { - result = -ENODEV; + result = -RT_EINVAL; } } else { - result = -ENODEV; + result = -RT_EINVAL; } return result; |
