From 50928211ca60e65d01f003de411ae19af034ae57 Mon Sep 17 00:00:00 2001 From: Felix Kopp Date: Thu, 7 Jan 2021 19:04:52 +0100 Subject: [PATCH] minor fixes and improvements --- arch/at91sam3x8e/serial.c | 3 +-- include/ardix/list.h | 2 +- kernel/userspace.c | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/at91sam3x8e/serial.c b/arch/at91sam3x8e/serial.c index 4e88105..d540fe1 100644 --- a/arch/at91sam3x8e/serial.c +++ b/arch/at91sam3x8e/serial.c @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -55,7 +54,6 @@ int arch_serial_init(struct serial_interface *interface) /* choose the events we want an interrupt on */ REG_UART_IDR = 0xFFFFFFFF; /* make sure all interrupts are disabled first */ REG_UART_IER = REG_UART_IER_RXRDY_MASK - | REG_UART_IER_ENDTX_MASK | REG_UART_IER_OVRE_MASK | REG_UART_IER_FRAME_MASK; @@ -129,6 +127,7 @@ void irq_uart(void) /* REG_UART_PDC_TCR has reached zero */ if (state & REG_UART_SR_ENDTX_MASK) { + /* this might be NULL but that's ok because free() tolerates that */ free(arch_serial_default_interface.tx_current); /* DMA automatically does this to the actual hardware registers */ diff --git a/include/ardix/list.h b/include/ardix/list.h index b6e11ef..db2fc97 100644 --- a/include/ardix/list.h +++ b/include/ardix/list.h @@ -36,7 +36,7 @@ struct list_head { #define list_last_entry(head, type, member) \ container_of((head)->prev, type, member) -#define list_is_empty(head) ((head)->next == head) +#define list_is_empty(head) ((head)->next == (head)) #define list_for_each(head, cursor) \ for (cursor = (head)->next; \ diff --git a/kernel/userspace.c b/kernel/userspace.c index 4d664ae..712048e 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -15,13 +15,13 @@ size_t copy_from_user(void *dest, __user const void *src, size_t len) { - void *tmp = memcpy(dest, src, len); + memcpy(dest, src, len); return len; } size_t copy_to_user(__user void *dest, const void *src, size_t len) { - void *tmp = memcpy(dest, src, len); + memcpy(dest, src, len); return len; }