diff options
| author | BernardXiong <[email protected]> | 2017-12-31 14:45:43 +0800 |
|---|---|---|
| committer | BernardXiong <[email protected]> | 2017-12-31 14:45:43 +0800 |
| commit | 8246da645d4569ca8d29c6b54efefaf4c313b343 (patch) | |
| tree | e65620223b8a947adeed465e4eb0c0fab48e7ba0 /components/drivers/src | |
| parent | 992e10ae08077fb11f4a125721c353aa1123916f (diff) | |
[DeviceDrivers] fix the compiling warning.
Diffstat (limited to 'components/drivers/src')
| -rw-r--r-- | components/drivers/src/pipe.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index 223337f81b..00630c52eb 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -360,7 +360,11 @@ rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_siz int read_bytes = 0; rt_pipe_t *pipe = (rt_pipe_t *)device; - if (device == RT_NULL) return -EINVAL; + if (device == RT_NULL) + { + rt_set_errno(-EINVAL); + return 0; + } if (count == 0) return 0; pbuf = (uint8_t*)buffer; @@ -384,7 +388,11 @@ rt_size_t rt_pipe_write (rt_device_t device, rt_off_t pos, const void *buffer, int write_bytes = 0; rt_pipe_t *pipe = (rt_pipe_t *)device; - if (device == RT_NULL) return -EINVAL; + if (device == RT_NULL) + { + rt_set_errno(-EINVAL); + return 0; + } if (count == 0) return 0; pbuf = (uint8_t*)buffer; |
