.. | .. |
---|
54 | 54 | #define DPRINTK(a, b...) \ |
---|
55 | 55 | printk(KERN_DEBUG "pm2fb: %s: " a, __func__ , ## b) |
---|
56 | 56 | #else |
---|
57 | | -#define DPRINTK(a, b...) |
---|
| 57 | +#define DPRINTK(a, b...) no_printk(a, ##b) |
---|
58 | 58 | #endif |
---|
59 | 59 | |
---|
60 | 60 | #define PM2_PIXMAP_SIZE (1600 * 4) |
---|
.. | .. |
---|
233 | 233 | switch (bpp) { |
---|
234 | 234 | case 24: |
---|
235 | 235 | timing *= 3; |
---|
236 | | - /* fall through */ |
---|
| 236 | + fallthrough; |
---|
237 | 237 | case 8: |
---|
238 | 238 | timing >>= 1; |
---|
239 | | - /* fall through */ |
---|
| 239 | + fallthrough; |
---|
240 | 240 | case 16: |
---|
241 | 241 | timing >>= 1; |
---|
242 | 242 | case 32: |
---|
.. | .. |
---|
613 | 613 | if (lpitch * var->yres_virtual > info->fix.smem_len) { |
---|
614 | 614 | DPRINTK("no memory for screen (%ux%ux%u)\n", |
---|
615 | 615 | var->xres, var->yres_virtual, var->bits_per_pixel); |
---|
| 616 | + return -EINVAL; |
---|
| 617 | + } |
---|
| 618 | + |
---|
| 619 | + if (!var->pixclock) { |
---|
| 620 | + DPRINTK("pixclock is zero\n"); |
---|
616 | 621 | return -EINVAL; |
---|
617 | 622 | } |
---|
618 | 623 | |
---|
.. | .. |
---|
1483 | 1488 | * Frame buffer operations |
---|
1484 | 1489 | */ |
---|
1485 | 1490 | |
---|
1486 | | -static struct fb_ops pm2fb_ops = { |
---|
| 1491 | +static const struct fb_ops pm2fb_ops = { |
---|
1487 | 1492 | .owner = THIS_MODULE, |
---|
1488 | 1493 | .fb_check_var = pm2fb_check_var, |
---|
1489 | 1494 | .fb_set_par = pm2fb_set_par, |
---|
.. | .. |
---|
1524 | 1529 | } |
---|
1525 | 1530 | |
---|
1526 | 1531 | info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev); |
---|
1527 | | - if (!info) |
---|
1528 | | - return -ENOMEM; |
---|
| 1532 | + if (!info) { |
---|
| 1533 | + err = -ENOMEM; |
---|
| 1534 | + goto err_exit_disable; |
---|
| 1535 | + } |
---|
1529 | 1536 | default_par = info->par; |
---|
1530 | 1537 | |
---|
1531 | 1538 | switch (pdev->device) { |
---|
.. | .. |
---|
1563 | 1570 | goto err_exit_neither; |
---|
1564 | 1571 | } |
---|
1565 | 1572 | default_par->v_regs = |
---|
1566 | | - ioremap_nocache(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); |
---|
| 1573 | + ioremap(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); |
---|
1567 | 1574 | if (!default_par->v_regs) { |
---|
1568 | 1575 | printk(KERN_WARNING "pm2fb: Can't remap %s register area.\n", |
---|
1569 | 1576 | pm2fb_fix.id); |
---|
.. | .. |
---|
1706 | 1713 | release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len); |
---|
1707 | 1714 | err_exit_neither: |
---|
1708 | 1715 | framebuffer_release(info); |
---|
| 1716 | + err_exit_disable: |
---|
| 1717 | + pci_disable_device(pdev); |
---|
1709 | 1718 | return retval; |
---|
1710 | 1719 | } |
---|
1711 | 1720 | |
---|
.. | .. |
---|
1732 | 1741 | fb_dealloc_cmap(&info->cmap); |
---|
1733 | 1742 | kfree(info->pixmap.addr); |
---|
1734 | 1743 | framebuffer_release(info); |
---|
| 1744 | + pci_disable_device(pdev); |
---|
1735 | 1745 | } |
---|
1736 | 1746 | |
---|
1737 | 1747 | static const struct pci_device_id pm2fb_id_table[] = { |
---|