Commit baf24530 authored by Mike Rapoport's avatar Mike Rapoport Committed by Greg Kroah-Hartman

staging: sm750fb: lynxfb_pci_probe: return actual errors

The lynxfb_pci_probe always returned -ENODEV in case of error. Modify it
so that actual error code will be propogated to the caller.
Signed-off-by: default avatarMike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0fbc7c50
...@@ -1006,18 +1006,17 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1006,18 +1006,17 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
struct fb_info *info[] = {NULL, NULL}; struct fb_info *info[] = {NULL, NULL};
struct sm750_dev *sm750_dev = NULL; struct sm750_dev *sm750_dev = NULL;
int fbidx; int fbidx;
int err;
/* enable device */ /* enable device */
if (pci_enable_device(pdev)) { err = pci_enable_device(pdev);
pr_err("can not enable device.\n"); if (err)
goto err_enable; return err;
}
err = -ENOMEM;
sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL); sm750_dev = kzalloc(sizeof(*sm750_dev), GFP_KERNEL);
if (!sm750_dev) { if (!sm750_dev)
pr_err("Could not allocate memory for share.\n"); goto disable_pci;
goto err_share;
}
sm750_dev->fbinfo[0] = sm750_dev->fbinfo[1] = NULL; sm750_dev->fbinfo[0] = sm750_dev->fbinfo[1] = NULL;
sm750_dev->devid = pdev->device; sm750_dev->devid = pdev->device;
...@@ -1051,10 +1050,9 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1051,10 +1050,9 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750fb_setup(sm750_dev, g_settings); sm750fb_setup(sm750_dev, g_settings);
/* call chip specific mmap routine */ /* call chip specific mmap routine */
if (hw_sm750_map(sm750_dev, pdev)) { err = hw_sm750_map(sm750_dev, pdev);
pr_err("Memory map failed\n"); if (err)
goto err_map; goto free_sm750_dev;
}
if (!sm750_dev->mtrr_off) if (!sm750_dev->mtrr_off)
sm750_dev->mtrr.vram = arch_phys_wc_add(sm750_dev->vidmem_start, sm750_dev->mtrr.vram = arch_phys_wc_add(sm750_dev->vidmem_start,
...@@ -1073,6 +1071,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1073,6 +1071,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
/* allocate frame buffer info structor according to g_dualview */ /* allocate frame buffer info structor according to g_dualview */
fbidx = 0; fbidx = 0;
ALLOC_FB: ALLOC_FB:
err = -ENOMEM;
info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev); info[fbidx] = framebuffer_alloc(sizeof(struct lynxfb_par), &pdev->dev);
if (!info[fbidx]) { if (!info[fbidx]) {
pr_err("Could not allocate framebuffer #%d.\n", fbidx); pr_err("Could not allocate framebuffer #%d.\n", fbidx);
...@@ -1082,7 +1081,6 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1082,7 +1081,6 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
goto err_info1_alloc; goto err_info1_alloc;
} else { } else {
struct lynxfb_par *par; struct lynxfb_par *par;
int errno;
pr_info("framebuffer #%d alloc okay\n", fbidx); pr_info("framebuffer #%d alloc okay\n", fbidx);
sm750_dev->fbinfo[fbidx] = info[fbidx]; sm750_dev->fbinfo[fbidx] = info[fbidx];
...@@ -1100,11 +1098,11 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1100,11 +1098,11 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
/* register frame buffer */ /* register frame buffer */
pr_info("Ready to register framebuffer #%d.\n", fbidx); pr_info("Ready to register framebuffer #%d.\n", fbidx);
errno = register_framebuffer(info[fbidx]); err = register_framebuffer(info[fbidx]);
if (errno < 0) { if (err < 0) {
pr_err("Failed to register fb_info #%d. err %d\n", pr_err("Failed to register fb_info #%d. err %d\n",
fbidx, fbidx,
errno); err);
if (fbidx == 0) if (fbidx == 0)
goto err_register0; goto err_register0;
else else
...@@ -1129,12 +1127,11 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, ...@@ -1129,12 +1127,11 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
err_info0_set: err_info0_set:
framebuffer_release(info[0]); framebuffer_release(info[0]);
err_info0_alloc: err_info0_alloc:
err_map: free_sm750_dev:
kfree(sm750_dev); kfree(sm750_dev);
err_share: disable_pci:
pci_disable_device(pdev); pci_disable_device(pdev);
err_enable: return err;
return -ENODEV;
} }
static void lynxfb_pci_remove(struct pci_dev *pdev) static void lynxfb_pci_remove(struct pci_dev *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment