Skip to contentSkip to conversation

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

PATCH New Jia-Ju Bai 1 participant 1 message Feb 25, 2022

Subsystems (4)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 video: fbdev: via: check the return value of ioremap() in viafb_lcd_get_mobile_state()

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")
---
 drivers/video/fbdev/via/lcd.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/video/fbdev/via/lcd.c +2 -0
index 088b962076b5..9aa331a4a605 100644
@@ -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 */
Signature · 1 line
2.17.1