Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] better error handing in savagefb_probe

err remains uninitialized of pci_request_regions fails.

Found by Thorsten Kukuk, I added a few more checks.

Signed-off-by: Olaf Hering <olh@suse.de>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Olaf Hering and committed by
Linus Torvalds
6062bfa1 544393fe

+5 -5
+5 -5
drivers/video/savage/savagefb_driver.c
··· 1976 1976 info->pixmap.buf_align = 4; 1977 1977 info->pixmap.access_align = 32; 1978 1978 1979 - fb_alloc_cmap (&info->cmap, NR_PALETTE, 0); 1979 + err = fb_alloc_cmap (&info->cmap, NR_PALETTE, 0); 1980 + if (!err) 1980 1981 info->flags |= FBINFO_HWACCEL_COPYAREA | 1981 1982 FBINFO_HWACCEL_FILLRECT | 1982 1983 FBINFO_HWACCEL_IMAGEBLIT; 1983 - 1984 - err = 0; 1985 1984 } 1986 1985 #endif 1987 1986 return err; ··· 2008 2009 if (err) 2009 2010 goto failed_enable; 2010 2011 2011 - if (pci_request_regions(dev, "savagefb")) { 2012 + if ((err = pci_request_regions(dev, "savagefb"))) { 2012 2013 printk(KERN_ERR "cannot request PCI regions\n"); 2013 2014 goto failed_enable; 2014 2015 } 2015 2016 2016 2017 err = -ENOMEM; 2017 2018 2018 - if (savage_init_fb_info(info, dev, id)) 2019 + if ((err = savage_init_fb_info(info, dev, id))) 2019 2020 goto failed_init; 2020 2021 2021 2022 err = savage_map_mmio(info); ··· 2023 2024 goto failed_mmio; 2024 2025 2025 2026 video_len = savage_init_hw(par); 2027 + /* FIXME: cant be negative */ 2026 2028 if (video_len < 0) { 2027 2029 err = video_len; 2028 2030 goto failed_mmio;