DORMANTno replies

[PATCH] video: fbdev: via: check the return value of ioremap() in viafb_lcd_get_mobile_state()

From: Jia-Ju Bai <hidden>
Date: 2022-02-25 12:45:46
Also in: lkml
Subsystem: framebuffer layer, the rest, via unichrome(pro)/chrome9 framebuffer driver · Maintainers: Helge Deller, Linus Torvalds, Florian Tobias Schandinat

The function ioremap() in viafb_lcd_get_mobile_state() can fail, so its
return value should be checked.

Fixes: ac6c97e20f1b ("viafb: lcd.c, lcd.h, lcdtbl.h")
Reported-by: TOTE Robot <redacted>
Signed-off-by: Jia-Ju Bai <redacted>
---
 drivers/video/fbdev/via/lcd.c | 2 ++
 1 file changed, 2 insertions(+)
diff --git a/drivers/video/fbdev/via/lcd.c b/drivers/video/fbdev/via/lcd.c
index 088b962076b5..9aa331a4a605 100644
--- a/drivers/video/fbdev/via/lcd.c
+++ b/drivers/video/fbdev/via/lcd.c
@@ -954,6 +954,8 @@ bool viafb_lcd_get_mobile_state(bool *mobile)
 	u16 start_pattern;
 
 	biosptr = ioremap(romaddr, 0x10000);
+	if (!biosptr)
+		return false;
 	start_pattern = readw(biosptr);
 
 	/* Compare pattern */
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help