staging: xgifb: fail the probe if no supported LCD video mode found
authorAaro Koskinen <aaro.koskinen@iki.fi>
Mon, 29 Aug 2011 20:14:29 +0000 (23:14 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 6 Sep 2011 18:41:24 +0000 (11:41 -0700)
Fail the probe if the LCD resolution described in card firmware does
not match any of the supported modes.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/xgifb/XGI_main_26.c

index 34678a3b0fc2ada61cb9093174bc907e3209132e..e989eb4e516345af2668db8ab405b0cf0da555f3 100644 (file)
@@ -449,7 +449,7 @@ static int XGIfb_GetXG21DefaultLVDSModeIdx(void)
                XGIfb_mode_idx++;
        }
        if (!found_mode)
-               XGIfb_mode_idx = 0;
+               XGIfb_mode_idx = -1;
 
        return XGIfb_mode_idx;
 }
@@ -2313,6 +2313,11 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
                }
        }
 
+       if (xgifb_mode_idx < 0) {
+               dev_err(&pdev->dev, "no supported video mode found\n");
+               goto error_1;
+       }
+
        if (xgi21_drvlcdcaplist) {
                int m;