aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers/keyboard.c
diff options
context:
space:
mode:
authorMarvin Borner2021-03-15 22:54:54 +0100
committerMarvin Borner2021-03-15 22:54:54 +0100
commitdc9f9f55cb6b38b87d8c228ae9abb4b53ebfb25c (patch)
treee4a51d5e94f963bcabe834b3ba535a8da871c42f /kernel/drivers/keyboard.c
parent665b00e7f44e5088b134d111ba1d5226c11f0ae8 (diff)
System hardening and errno impl
Diffstat (limited to 'kernel/drivers/keyboard.c')
-rw-r--r--kernel/drivers/keyboard.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/drivers/keyboard.c b/kernel/drivers/keyboard.c
index dbee8e1..79cd579 100644
--- a/kernel/drivers/keyboard.c
+++ b/kernel/drivers/keyboard.c
@@ -2,6 +2,7 @@
#include <cpu.h>
#include <def.h>
+#include <errno.h>
#include <fs.h>
#include <interrupts.h>
#include <keyboard.h>
@@ -62,9 +63,9 @@ static void keyboard_rate(void)
static s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev)
{
- (void)dev;
+ UNUSED(dev);
if (stack_empty(queue))
- return -1;
+ return -EINVAL;
struct event_keyboard *e = stack_pop(queue);
memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e)));
@@ -72,7 +73,7 @@ static s32 keyboard_read(void *buf, u32 offset, u32 count, struct device *dev)
return MIN(count, sizeof(*e));
}
-static u8 keyboard_ready(void)
+static s32 keyboard_ready(void)
{
return !stack_empty(queue);
}