linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
To: Jonathan Corbet <corbet@lwn.net>
Cc: "Bruno Prémont" <bonbons@linux-vserver.org>,
	linux-kernel@vger.kernel.org,
	"Harald Welte" <laforge@gnumonks.org>,
	linux-fbdev@vger.kernel.org, JosephChan@via.com.tw,
	ScottFang@viatech.com.cn
Subject: Re: [PATCH 13/30] viafb: Separate global and fb-specific data
Date: Fri, 30 Apr 2010 18:07:02 +0000	[thread overview]
Message-ID: <4BDB1C46.8020101@gmx.de> (raw)
In-Reply-To: <20100430102157.5eb59055@bike.lwn.net>

Hi,

Jonathan Corbet schrieb:
> On Thu, 29 Apr 2010 20:19:02 +0200
> Bruno Prémont <bonbons@linux-vserver.org> wrote:
> 
>>> +	vdev->engine_start = pci_resource_start(vdev->pdev, 1);
>>> +	vdev->engine_len = pci_resource_len(vdev->pdev, 1);
>>> +	/* If this fails, others will notice later */
>>> +	vdev->engine_mmio = ioremap_nocache(vdev->engine_start,
>>> +			vdev->engine_len);
>> Shouldn't this ioremap_nocache() have error-checking
>> as the one below (instead of relying on later code to bail out)?
> 
> It would be better, yes, I'll add a patch to fix it up.

Please don't do this. The reason for not failing in viafb is that 
ioremap failure of the engine is not critical it just disables the 
hardware acceleration but otherwiese it works quite nice. The problem is 
that ioremap failures are quite common as we really try to remap huge 
amount (sometimes above 128 or even 256 MB). In fact the bug (or missing 
feature) is that the first ioremap is fatal and that needs to be fixed 
on the long run. Sorry but I don't want to make viafb unusable for many 
people if they don't add the "vmalloc=" kernel option so failing here 
would be a step in the wrong direction.


Thanks,

Florian Tobias Schandinat

> viafb: Fix initialization error paths
> 
> Properly localize error cleanup, and make sure that the iomem regions are
> unmapped if framebuffer initialization fails.
> 
> Reported-by: Bruno Prémont <bonbons@linux-vserver.org>
> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
> ---
>  drivers/video/via/via-core.c |   26 ++++++++++++++++----------
>  1 files changed, 16 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c
> index 2b5773a..b8a8783 100644
> --- a/drivers/video/via/via-core.c
> +++ b/drivers/video/via/via-core.c
> @@ -454,26 +454,32 @@ static int viafb_get_fb_size_from_pci(int chip_type)
>   */
>  static int __devinit via_pci_setup_mmio(struct viafb_dev *vdev)
>  {
> +	int ret;
>  	/*
>  	 * Hook up to the device registers.
>  	 */
>  	vdev->engine_start = pci_resource_start(vdev->pdev, 1);
>  	vdev->engine_len = pci_resource_len(vdev->pdev, 1);
> -	/* If this fails, others will notice later */
>  	vdev->engine_mmio = ioremap_nocache(vdev->engine_start,
>  			vdev->engine_len);
> -
> +	if (vdev->engine_mmio = NULL)
> +		return -ENOMEM;
>  	/*
> -	 * Likewise with I/O memory.
> +	 * Likewise with framebuffer memory.
>  	 */
>  	vdev->fbmem_start = pci_resource_start(vdev->pdev, 0);
> -	vdev->fbmem_len = viafb_get_fb_size_from_pci(vdev->chip_type);
> -	if (vdev->fbmem_len < 0)
> -		return vdev->fbmem_len;
> +	ret = vdev->fbmem_len = viafb_get_fb_size_from_pci(vdev->chip_type);
> +	if (ret < 0)
> +		goto out_unmap;
>  	vdev->fbmem = ioremap_nocache(vdev->fbmem_start, vdev->fbmem_len);
> -	if (vdev->fbmem = NULL)
> -		return -ENOMEM;
> +	if (vdev->fbmem = NULL) {
> +		ret = -ENOMEM;
> +		goto out_unmap;
> +	}
>  	return 0;
> +out_unmap:
> +	iounmap(vdev->engine_mmio);
> +	return ret;
>  }
>  
>  static void __devexit via_pci_teardown_mmio(struct viafb_dev *vdev)
> @@ -566,13 +572,13 @@ static int __devinit via_pci_probe(struct pci_dev *pdev,
>  	spin_lock_init(&global_dev.reg_lock);
>  	ret = via_pci_setup_mmio(&global_dev);
>  	if (ret)
> -		goto out_teardown;
> +		return ret;
>  	/*
>  	 * Set up the framebuffer device
>  	 */
>  	ret = via_fb_pci_probe(&global_dev);
>  	if (ret)
> -		return ret;
> +		goto out_teardown;
>  	/*
>  	 * Create our subdevices.
>  	 */


  reply	other threads:[~2010-04-30 18:07 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-28 22:17 [RFC] Second OLPC Viafb series, v2 Jonathan Corbet
2010-04-28 22:17 ` [PATCH 01/30] viafb: Fix various resource leaks during module_init() Jonathan Corbet
2010-04-28 22:17 ` [PATCH 02/30] viafb: use proper pci config API Jonathan Corbet
2010-05-01 14:01   ` Florian Tobias Schandinat
2010-05-04  2:37     ` Jonathan Corbet
2010-04-28 22:17 ` [PATCH 03/30] viafb: Unmap the frame buffer on initialization error Jonathan Corbet
2010-04-28 22:17 ` [PATCH 04/30] viafb: Retain GEMODE reserved bits Jonathan Corbet
2010-04-28 22:17 ` [PATCH 05/30] viafb: Unify duplicated set_bpp() code Jonathan Corbet
2010-04-28 22:17 ` [PATCH 06/30] viafb: Determine type of 2D engine and store it in chip_info Jonathan Corbet
2010-04-28 22:17 ` [PATCH 07/30] viafb: complete support for VX800/VX855 accelerated framebuffer Jonathan Corbet
2010-04-28 22:17 ` [PATCH 08/30] viafb: Add 1200x900 DCON/LCD panel modes for OLPC XO-1.5 Jonathan Corbet
2010-04-28 22:17 ` [PATCH 09/30] viafb: rework the I2C support in the VIA framebuffer driver Jonathan Corbet
2010-04-28 22:17 ` [PATCH 10/30] suppress verbose debug messages: change printk() to DEBUG_MSG() Jonathan Corbet
2010-04-28 22:17 ` [PATCH 11/30] viafb: Only establish i2c busses on ports that always had them Jonathan Corbet
2010-04-28 22:17 ` [PATCH 12/30] viafb: Move core stuff into via-core.c Jonathan Corbet
2010-05-01 15:02   ` Florian Tobias Schandinat
2010-05-01 15:08     ` Jonathan Corbet
2010-05-01 15:29       ` Florian Tobias Schandinat
2010-04-28 22:17 ` [PATCH 13/30] viafb: Separate global and fb-specific data Jonathan Corbet
2010-04-29 18:19   ` Bruno Prémont
2010-04-30 16:21     ` Jonathan Corbet
2010-04-30 18:07       ` Florian Tobias Schandinat [this message]
2010-04-30 18:22         ` Jonathan Corbet
2010-04-30 18:43           ` Florian Tobias Schandinat
2010-04-30 20:01             ` Bruno Prémont
2010-04-28 22:17 ` [PATCH 14/30] viafb: add a driver for GPIO lines Jonathan Corbet
2010-04-28 22:17 ` [PATCH 15/30] viafb: package often used basic io functions Jonathan Corbet
2010-04-28 22:17 ` [PATCH 16/30] viafb: Convert GPIO and i2c to the new indexed port ops Jonathan Corbet
2010-04-28 22:17 ` [PATCH 17/30] viafb: Turn GPIO and i2c into proper platform devices Jonathan Corbet
2010-04-28 22:17 ` [PATCH 18/30] via: Do not attempt I/O on inactive I2C adapters Jonathan Corbet
2010-04-28 22:17 ` [PATCH 19/30] viafb: Introduce viafb_find_i2c_adapter() Jonathan Corbet
2010-04-28 22:17 ` [PATCH 20/30] via: Rationalize vt1636 detection Jonathan Corbet
2010-04-28 22:17 ` [PATCH 21/30] viafb: Add a simple interrupt management infrastructure Jonathan Corbet
2010-04-28 22:17 ` [PATCH 22/30] viafb: Add a simple VX855 DMA engine driver Jonathan Corbet
2010-04-28 22:17 ` [PATCH 23/30] viafb: Reserve framebuffer memory for the upcoming camera driver Jonathan Corbet
2010-04-28 22:17 ` [PATCH 24/30] viafb: Add a driver for the video capture engine Jonathan Corbet
2010-04-29 17:16   ` Bruno Prémont
2010-04-29 19:06     ` Jonathan Corbet
2010-05-02  1:18   ` Florian Tobias Schandinat
2010-05-02  1:52     ` Jonathan Corbet
2010-04-28 22:17 ` [PATCH 25/30] viafb: unify modesetting functions Jonathan Corbet
2010-04-28 22:17 ` [PATCH 26/30] viafb: move some modesetting functions to a seperate file Jonathan Corbet
2010-04-28 22:17 ` [PATCH 27/30] viafb: replace inb/outb Jonathan Corbet
2010-04-28 22:17 ` [PATCH 28/30] viafb: improve misc register handling Jonathan Corbet
2010-04-28 22:17 ` [PATCH 29/30] viafb: fix proc entry removal Jonathan Corbet
2010-04-28 22:17 ` [PATCH 30/30] viafb: make procfs entries optional Jonathan Corbet
2010-04-29 17:26 ` [RFC] Second OLPC Viafb series, v2 Bruno Prémont
2010-04-30 15:39   ` Jonathan Corbet
2010-05-01 21:28 ` Florian Tobias Schandinat
2010-05-01 22:57   ` Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BDB1C46.8020101@gmx.de \
    --to=florianschandinat@gmx.de \
    --cc=JosephChan@via.com.tw \
    --cc=ScottFang@viatech.com.cn \
    --cc=bonbons@linux-vserver.org \
    --cc=corbet@lwn.net \
    --cc=laforge@gnumonks.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).