lkml.org 
[lkml]   [2015]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 4/9] video: Add check for return value of ioremap() in cirrusfb_pci_register()
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Mon, 19 Jan 2015 13:18:50 +0100

    The return value from a call of the ioremap() function was not checked
    by the implementation of the cirrusfb_pci_register() function.
    Let us complete the corresponding error detection and exception handling
    at this source code place.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/video/fbdev/cirrusfb.c | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c
    index d8b3359..aa4050c 100644
    --- a/drivers/video/fbdev/cirrusfb.c
    +++ b/drivers/video/fbdev/cirrusfb.c
    @@ -2111,6 +2111,10 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
    /* FIXME: this forces VGA. alternatives? */
    cinfo->regbase = NULL;
    cinfo->laguna_mmio = ioremap(info->fix.mmio_start, 0x1000);
    + if (!cinfo->laguna_mmio) {
    + ret = -EIO;
    + goto err_release_fb;
    + }

    dev_dbg(info->device, "Board address: 0x%lx, register address: 0x%lx\n",
    board_addr, info->fix.mmio_start);
    @@ -2122,7 +2126,7 @@ static int cirrusfb_pci_register(struct pci_dev *pdev,
    if (ret < 0) {
    dev_err(info->device, "cannot reserve region 0x%lx, abort\n",
    board_addr);
    - goto err_release_fb;
    + goto io_unmap_laguna;
    }
    #if 0 /* if the system didn't claim this region, we would... */
    if (!request_mem_region(0xA0000, 65535, "cirrusfb")) {
    @@ -2163,8 +2167,9 @@ err_release_legacy:
    err_release_regions:
    #endif
    pci_release_regions(pdev);
    -err_release_fb:
    +io_unmap_laguna:
    iounmap(cinfo->laguna_mmio);
    +err_release_fb:
    framebuffer_release(info);
    err_out:
    return ret;
    --
    2.2.2


    \
     
     \ /
      Last update: 2015-01-19 19:41    [W:4.023 / U:6.932 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site