]> err.no Git - linux-2.6/commitdiff
vt8623fb: fix kernel oops
authorOndrej Zajicek <santiago@crfreenet.org>
Tue, 5 Aug 2008 20:01:06 +0000 (13:01 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 5 Aug 2008 21:33:46 +0000 (14:33 -0700)
commit 20e061fb750d36ec0ffcb2e44ed7dafa9018223b
  Author: Ondrej Zajicek <santiago@crfreenet.org>
  Date:   Mon Apr 28 02:15:18 2008 -0700

      fbdev: framebuffer_alloc() fixes

      Correct the dev arg of framebuffer_alloc() in arkfb, s3fb and vt8623fb.

causes a null-pointer deref because "info->dev is NULL, info was just
kzallocated".

Signed-off-by: Ondrej Zajicek <santiago@crfreenet.org>
Reported-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Tested-by: "MadLoisae@gmx.net" <MadLoisae@gmx.net>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
Cc: <stable@kernel.org> [2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/arkfb.c
drivers/video/s3fb.c
drivers/video/vt8623fb.c

index 38a1e8308c837d28d666e86a29b3097658020524..4bd569e479a723c70d3f3532271a65e4d111dab7 100644 (file)
@@ -958,20 +958,20 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        /* Prepare PCI device */
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "arkfb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
        par->dac = ics5342_init(ark_dac_read_regs, ark_dac_write_regs, info);
        if (! par->dac) {
                rc = -ENOMEM;
-               dev_err(info->dev, "RAMDAC initialization failed\n");
+               dev_err(info->device, "RAMDAC initialization failed\n");
                goto err_dac;
        }
 
@@ -982,7 +982,7 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap;
        }
 
@@ -1004,19 +1004,19 @@ static int __devinit ark_pci_probe(struct pci_dev *dev, const struct pci_device_
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebugger\n");
+               dev_err(info->device, "cannot register framebugger\n");
                goto err_reg_fb;
        }
 
@@ -1090,7 +1090,7 @@ static int ark_pci_suspend (struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct arkfb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1121,7 +1121,7 @@ static int ark_pci_resume (struct pci_dev* dev)
        struct fb_info *info = pci_get_drvdata(dev);
        struct arkfb_info *par = info->par;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
index 2972f112dbed29876c3652210812c7c5e854eebe..8361bd0e3df1dd55bdbf1f31b3d1eb08802df28a 100644 (file)
@@ -903,13 +903,13 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        /* Prepare PCI device */
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "s3fb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
@@ -921,7 +921,7 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap;
        }
 
@@ -965,19 +965,19 @@ static int __devinit s3_pci_probe(struct pci_dev *dev, const struct pci_device_i
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebuffer\n");
+               dev_err(info->device, "cannot register framebuffer\n");
                goto err_reg_fb;
        }
 
@@ -1053,7 +1053,7 @@ static int s3_pci_suspend(struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct s3fb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1085,7 +1085,7 @@ static int s3_pci_resume(struct pci_dev* dev)
        struct s3fb_info *par = info->par;
        int err;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -1102,7 +1102,7 @@ static int s3_pci_resume(struct pci_dev* dev)
        if (err) {
                mutex_unlock(&(par->open_lock));
                release_console_sem();
-               dev_err(info->dev, "error %d enabling device for resume\n", err);
+               dev_err(info->device, "error %d enabling device for resume\n", err);
                return err;
        }
        pci_set_master(dev);
index 4a484ee98f8a5e1af8bbe355bbe7ed5d37593311..34aae7a2a62b35a3dd2aa4436816f844f588f616 100644 (file)
@@ -677,13 +677,13 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
 
        rc = pci_enable_device(dev);
        if (rc < 0) {
-               dev_err(info->dev, "cannot enable PCI device\n");
+               dev_err(info->device, "cannot enable PCI device\n");
                goto err_enable_device;
        }
 
        rc = pci_request_regions(dev, "vt8623fb");
        if (rc < 0) {
-               dev_err(info->dev, "cannot reserve framebuffer region\n");
+               dev_err(info->device, "cannot reserve framebuffer region\n");
                goto err_request_regions;
        }
 
@@ -696,14 +696,14 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        info->screen_base = pci_iomap(dev, 0, 0);
        if (! info->screen_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for framebuffer failed\n");
+               dev_err(info->device, "iomap for framebuffer failed\n");
                goto err_iomap_1;
        }
 
        par->mmio_base = pci_iomap(dev, 1, 0);
        if (! par->mmio_base) {
                rc = -ENOMEM;
-               dev_err(info->dev, "iomap for MMIO failed\n");
+               dev_err(info->device, "iomap for MMIO failed\n");
                goto err_iomap_2;
        }
 
@@ -714,7 +714,7 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        if ((16 <= memsize1) && (memsize1 <= 64) && (memsize1 == memsize2))
                info->screen_size = memsize1 << 20;
        else {
-               dev_err(info->dev, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2);
+               dev_err(info->device, "memory size detection failed (%x %x), suppose 16 MB\n", memsize1, memsize2);
                info->screen_size = 16 << 20;
        }
 
@@ -731,19 +731,19 @@ static int __devinit vt8623_pci_probe(struct pci_dev *dev, const struct pci_devi
        rc = fb_find_mode(&(info->var), info, mode_option, NULL, 0, NULL, 8);
        if (! ((rc == 1) || (rc == 2))) {
                rc = -EINVAL;
-               dev_err(info->dev, "mode %s not found\n", mode_option);
+               dev_err(info->device, "mode %s not found\n", mode_option);
                goto err_find_mode;
        }
 
        rc = fb_alloc_cmap(&info->cmap, 256, 0);
        if (rc < 0) {
-               dev_err(info->dev, "cannot allocate colormap\n");
+               dev_err(info->device, "cannot allocate colormap\n");
                goto err_alloc_cmap;
        }
 
        rc = register_framebuffer(info);
        if (rc < 0) {
-               dev_err(info->dev, "cannot register framebugger\n");
+               dev_err(info->device, "cannot register framebugger\n");
                goto err_reg_fb;
        }
 
@@ -817,7 +817,7 @@ static int vt8623_pci_suspend(struct pci_dev* dev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(dev);
        struct vt8623fb_info *par = info->par;
 
-       dev_info(info->dev, "suspend\n");
+       dev_info(info->device, "suspend\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));
@@ -848,7 +848,7 @@ static int vt8623_pci_resume(struct pci_dev* dev)
        struct fb_info *info = pci_get_drvdata(dev);
        struct vt8623fb_info *par = info->par;
 
-       dev_info(info->dev, "resume\n");
+       dev_info(info->device, "resume\n");
 
        acquire_console_sem();
        mutex_lock(&(par->open_lock));