Skip to content

Commit 8246da6

Browse files
committed
[DeviceDrivers] fix the compiling warning.
1 parent 992e10a commit 8246da6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

components/drivers/src/pipe.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,11 @@ rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_siz
360360
int read_bytes = 0;
361361
rt_pipe_t *pipe = (rt_pipe_t *)device;
362362

363-
if (device == RT_NULL) return -EINVAL;
363+
if (device == RT_NULL)
364+
{
365+
rt_set_errno(-EINVAL);
366+
return 0;
367+
}
364368
if (count == 0) return 0;
365369

366370
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,
384388
int write_bytes = 0;
385389
rt_pipe_t *pipe = (rt_pipe_t *)device;
386390

387-
if (device == RT_NULL) return -EINVAL;
391+
if (device == RT_NULL)
392+
{
393+
rt_set_errno(-EINVAL);
394+
return 0;
395+
}
388396
if (count == 0) return 0;
389397

390398
pbuf = (uint8_t*)buffer;

0 commit comments

Comments
 (0)