Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757060AbXIRMT2 (ORCPT ); Tue, 18 Sep 2007 08:19:28 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754507AbXIRMTV (ORCPT ); Tue, 18 Sep 2007 08:19:21 -0400 Received: from cerber.ds.pg.gda.pl ([153.19.208.18]:34688 "EHLO cerber.ds.pg.gda.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751755AbXIRMTU (ORCPT ); Tue, 18 Sep 2007 08:19:20 -0400 Date: Tue, 18 Sep 2007 13:18:34 +0100 (BST) From: "Maciej W. Rozycki" To: Andrew Morton , Antonino Daplas cc: linux-fbdev-devel@lists.sourceforge.net, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers/video/pmag-ba-fb.c: Improve diagnostics In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3180 Lines: 104 Add error messages to the probe call. Signed-off-by: Maciej W. Rozycki --- While they may rarely trigger, they may be useful when something weird is going on. Also this is good style. This is an updated version that addresses an issue raised by Mariusz Kozlowski for the sibling patch. Checked with checkpatch.pl. Please apply. Maciej patch-mips-2.6.23-rc5-20070904-pmag-ba-err-2 diff -up --recursive --new-file linux-mips-2.6.23-rc5-20070904.macro/drivers/video/pmag-ba-fb.c linux-mips-2.6.23-rc5-20070904/drivers/video/pmag-ba-fb.c --- linux-mips-2.6.23-rc5-20070904.macro/drivers/video/pmag-ba-fb.c 2007-02-21 05:56:47.000000000 +0000 +++ linux-mips-2.6.23-rc5-20070904/drivers/video/pmag-ba-fb.c 2007-09-18 10:56:51.000000000 +0000 @@ -147,16 +147,23 @@ static int __init pmagbafb_probe(struct resource_size_t start, len; struct fb_info *info; struct pmagbafb_par *par; + int err = 0; 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; + } par = info->par; 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; + } info->fbops = &pmagbafb_ops; info->fix = pmagbafb_fix; @@ -166,28 +173,41 @@ static int __init pmagbafb_probe(struct /* Request the I/O MEM resource. */ start = tdev->resource.start; 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; + } /* MMIO mapping setup. */ info->fix.mmio_start = start; 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; + } par->dac = par->mmio + PMAG_BA_BT459; /* Frame buffer mapping setup. */ info->fix.smem_start = start + PMAG_BA_FBMEM; info->screen_base = ioremap_nocache(info->fix.smem_start, 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; + } info->screen_size = info->fix.smem_len; 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; + } get_device(dev); @@ -211,7 +231,7 @@ err_cmap: err_alloc: framebuffer_release(info); - return -ENXIO; + return err; } static int __exit pmagbafb_remove(struct device *dev) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/