aboutsummaryrefslogtreecommitdiff
path: root/kernel/drivers
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
parent665b00e7f44e5088b134d111ba1d5226c11f0ae8 (diff)
System hardening and errno impl
Diffstat (limited to 'kernel/drivers')
-rw-r--r--kernel/drivers/fb.c2
-rw-r--r--kernel/drivers/keyboard.c7
-rw-r--r--kernel/drivers/mouse.c5
3 files changed, 8 insertions, 6 deletions
diff --git a/kernel/drivers/fb.c b/kernel/drivers/fb.c
index 8e73f5b..af8a830 100644
--- a/kernel/drivers/fb.c
+++ b/kernel/drivers/fb.c
@@ -45,7 +45,7 @@ static s32 fb_ioctl(u32 request, void *arg1, void *arg2, void *arg3, struct devi
}
}
-static u8 fb_ready(void)
+static s32 fb_ready(void)
{
return 1;
}
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);
}
diff --git a/kernel/drivers/mouse.c b/kernel/drivers/mouse.c
index 5c481da..8545099 100644
--- a/kernel/drivers/mouse.c
+++ b/kernel/drivers/mouse.c
@@ -2,6 +2,7 @@
#include <boot.h>
#include <cpu.h>
+#include <errno.h>
#include <fs.h>
#include <interrupts.h>
#include <mem.h>
@@ -83,7 +84,7 @@ static u8 mouse_serial_read(void)
return inb(0x60);
}
-static u8 mouse_ready(void)
+static s32 mouse_ready(void)
{
return !stack_empty(queue);
}
@@ -92,7 +93,7 @@ static s32 mouse_read(void *buf, u32 offset, u32 count, struct device *dev)
{
(void)dev;
if (stack_empty(queue))
- return -1;
+ return -EINVAL;
struct event_mouse *e = stack_pop(queue);
memcpy(buf, (u8 *)e + offset, MIN(count, sizeof(*e)));