From: Adrian Bunk Date: Thu, 22 Mar 2007 08:11:16 +0000 (-0800) Subject: [PATCH] drivers/video/s3fb.c: fix a use-before-check X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=47ebea8351061f763089f6c3e2d2403715b510e1;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] drivers/video/s3fb.c: fix a use-before-check NULL checks should be before the first dereference. Spotted by the Coverity checker. Signed-off-by: Adrian Bunk Acked-by: Ondrej Zajicek Cc: "Antonino A. Daplas" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/video/s3fb.c b/drivers/video/s3fb.c index 98919a6975f0..3091b20124b4 100644 --- a/drivers/video/s3fb.c +++ b/drivers/video/s3fb.c @@ -1000,11 +1000,12 @@ err_enable_device: static void __devexit s3_pci_remove(struct pci_dev *dev) { struct fb_info *info = pci_get_drvdata(dev); - struct s3fb_info *par = info->par; if (info) { #ifdef CONFIG_MTRR + struct s3fb_info *par = info->par; + if (par->mtrr_reg >= 0) { mtrr_del(par->mtrr_reg, 0, 0); par->mtrr_reg = -1;