[PATCH] drivers/video/s3fb.c: fix a use-before-check
authorAdrian Bunk <[email protected]>
Thu, 22 Mar 2007 08:11:16 +0000 (00:11 -0800)
committerLinus Torvalds <[email protected]>
Fri, 23 Mar 2007 02:39:05 +0000 (19:39 -0700)
NULL checks should be before the first dereference.

Spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <[email protected]>
Acked-by: Ondrej Zajicek <[email protected]>
Cc: "Antonino A. Daplas" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/video/s3fb.c

index 98919a6975f04b10ccec1219335dd60a2970d61e..3091b20124b45eb94d609da9a9702a92e9e1c9c1 100644 (file)
@@ -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;