[PATCH 2/2] console: Don't start/stop console if stdio device invalid

Nicolas Saenz Julienne nsaenzjulienne at suse.de
Wed Jan 20 15:04:54 CET 2021


Don't start/stop an stdio device that might have been already freed.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne at suse.de>
Fixes: 70c2525c0d3c ("IOMUX: Stop dropped consoles")
---
 common/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/console.c b/common/console.c
index f3cc45cab5..5c6b74b351 100644
--- a/common/console.c
+++ b/common/console.c
@@ -252,6 +252,9 @@ static bool console_needs_start_stop(int file, struct stdio_dev *sdev)
 {
 	int i, j;
 
+	if (!stdio_valid(sdev))
+		return false;
+
 	for (i = 0; i < ARRAY_SIZE(cd_count); i++) {
 		if (i == file)
 			continue;
-- 
2.30.0



More information about the U-Boot mailing list