summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/tty_buffer.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/tty/tty_buffer.c b/drivers/tty/tty_buffer.c
index c996b6859c5e..76151c002858 100644
--- a/drivers/tty/tty_buffer.c
+++ b/drivers/tty/tty_buffer.c
@@ -118,9 +118,12 @@ void tty_buffer_free_all(struct tty_port *port)
struct tty_bufhead *buf = &port->buf;
struct tty_buffer *p, *next;
struct llist_node *llist;
+ unsigned int freed = 0;
+ int still_used;
while ((p = buf->head) != NULL) {
buf->head = p->next;
+ freed += p->size;
if (p->size > 0)
kfree(p);
}
@@ -132,7 +135,9 @@ void tty_buffer_free_all(struct tty_port *port)
buf->head = &buf->sentinel;
buf->tail = &buf->sentinel;
- atomic_set(&buf->mem_used, 0);
+ still_used = atomic_xchg(&buf->mem_used, 0);
+ WARN(still_used != freed, "we still have not freed %d bytes!",
+ still_used - freed);
}
/**
OpenPOWER on IntegriCloud