drivers/video/pmag-ba-fb.c: improve diagnostics
Add error messages to the probe call. While they may rarely trigger, they may be useful when something weird is going on. Also this is good style. [akpm@linux-foundation.org: remove unneeded initialisation] Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: "Antonino A. Daplas" <adaplas@pol.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
0b693eafc4
Коммит
53ee1b5bbf
|
@ -147,16 +147,23 @@ static int __init pmagbafb_probe(struct device *dev)
|
||||||
resource_size_t start, len;
|
resource_size_t start, len;
|
||||||
struct fb_info *info;
|
struct fb_info *info;
|
||||||
struct pmagbafb_par *par;
|
struct pmagbafb_par *par;
|
||||||
|
int err;
|
||||||
|
|
||||||
info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev);
|
info = framebuffer_alloc(sizeof(struct pmagbafb_par), dev);
|
||||||
if (!info)
|
if (!info) {
|
||||||
|
printk(KERN_ERR "%s: Cannot allocate memory\n", dev->bus_id);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
par = info->par;
|
par = info->par;
|
||||||
dev_set_drvdata(dev, info);
|
dev_set_drvdata(dev, info);
|
||||||
|
|
||||||
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0)
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
||||||
|
printk(KERN_ERR "%s: Cannot allocate color map\n",
|
||||||
|
dev->bus_id);
|
||||||
|
err = -ENOMEM;
|
||||||
goto err_alloc;
|
goto err_alloc;
|
||||||
|
}
|
||||||
|
|
||||||
info->fbops = &pmagbafb_ops;
|
info->fbops = &pmagbafb_ops;
|
||||||
info->fix = pmagbafb_fix;
|
info->fix = pmagbafb_fix;
|
||||||
|
@ -166,28 +173,41 @@ static int __init pmagbafb_probe(struct device *dev)
|
||||||
/* Request the I/O MEM resource. */
|
/* Request the I/O MEM resource. */
|
||||||
start = tdev->resource.start;
|
start = tdev->resource.start;
|
||||||
len = tdev->resource.end - start + 1;
|
len = tdev->resource.end - start + 1;
|
||||||
if (!request_mem_region(start, len, dev->bus_id))
|
if (!request_mem_region(start, len, dev->bus_id)) {
|
||||||
|
printk(KERN_ERR "%s: Cannot reserve FB region\n", dev->bus_id);
|
||||||
|
err = -EBUSY;
|
||||||
goto err_cmap;
|
goto err_cmap;
|
||||||
|
}
|
||||||
|
|
||||||
/* MMIO mapping setup. */
|
/* MMIO mapping setup. */
|
||||||
info->fix.mmio_start = start;
|
info->fix.mmio_start = start;
|
||||||
par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len);
|
par->mmio = ioremap_nocache(info->fix.mmio_start, info->fix.mmio_len);
|
||||||
if (!par->mmio)
|
if (!par->mmio) {
|
||||||
|
printk(KERN_ERR "%s: Cannot map MMIO\n", dev->bus_id);
|
||||||
|
err = -ENOMEM;
|
||||||
goto err_resource;
|
goto err_resource;
|
||||||
|
}
|
||||||
par->dac = par->mmio + PMAG_BA_BT459;
|
par->dac = par->mmio + PMAG_BA_BT459;
|
||||||
|
|
||||||
/* Frame buffer mapping setup. */
|
/* Frame buffer mapping setup. */
|
||||||
info->fix.smem_start = start + PMAG_BA_FBMEM;
|
info->fix.smem_start = start + PMAG_BA_FBMEM;
|
||||||
info->screen_base = ioremap_nocache(info->fix.smem_start,
|
info->screen_base = ioremap_nocache(info->fix.smem_start,
|
||||||
info->fix.smem_len);
|
info->fix.smem_len);
|
||||||
if (!info->screen_base)
|
if (!info->screen_base) {
|
||||||
|
printk(KERN_ERR "%s: Cannot map FB\n", dev->bus_id);
|
||||||
|
err = -ENOMEM;
|
||||||
goto err_mmio_map;
|
goto err_mmio_map;
|
||||||
|
}
|
||||||
info->screen_size = info->fix.smem_len;
|
info->screen_size = info->fix.smem_len;
|
||||||
|
|
||||||
pmagbafb_erase_cursor(info);
|
pmagbafb_erase_cursor(info);
|
||||||
|
|
||||||
if (register_framebuffer(info) < 0)
|
err = register_framebuffer(info);
|
||||||
|
if (err < 0) {
|
||||||
|
printk(KERN_ERR "%s: Cannot register framebuffer\n",
|
||||||
|
dev->bus_id);
|
||||||
goto err_smem_map;
|
goto err_smem_map;
|
||||||
|
}
|
||||||
|
|
||||||
get_device(dev);
|
get_device(dev);
|
||||||
|
|
||||||
|
@ -211,7 +231,7 @@ err_cmap:
|
||||||
|
|
||||||
err_alloc:
|
err_alloc:
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
return -ENXIO;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __exit pmagbafb_remove(struct device *dev)
|
static int __exit pmagbafb_remove(struct device *dev)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче