mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Miguel Gómez" <magomez@igalia.com>
To: arnaud.patard@rtp-net.org, gregkh@linuxfoundation.org,
	aaro.koskinen@iki.fi, dan.carpenter@oracle.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	"Miguel Gómez" <magomez@igalia.com>
Subject: [PATCH 3/4] Staging: xgifb: disable pci device if there's an error after enabling it.
Date: Wed,  6 Jun 2012 16:22:06 +0200	[thread overview]
Message-ID: <1338992527-5659-3-git-send-email-magomez@igalia.com> (raw)
In-Reply-To: <1338992527-5659-1-git-send-email-magomez@igalia.com>

Signed-off-by: Miguel Gómez <magomez@igalia.com>
---
 drivers/staging/xgifb/XGI_main_26.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/xgifb/XGI_main_26.c b/drivers/staging/xgifb/XGI_main_26.c
index 96abb23..438781f 100644
--- a/drivers/staging/xgifb/XGI_main_26.c
+++ b/drivers/staging/xgifb/XGI_main_26.c
@@ -1904,7 +1904,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	if (reg1 != 0xa1) { /*I/O error */
 		pr_err("I/O error!!!");
 		ret = -EIO;
-		goto error;
+		goto error_disable;
 	}
 
 	switch (xgifb_info->chip_id) {
@@ -1927,7 +1927,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		break;
 	default:
 		ret = -ENODEV;
-		goto error;
+		goto error_disable;
 	}
 
 	pr_info("chipid = %x\n", xgifb_info->chip);
@@ -1936,7 +1936,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 	if (XGIfb_get_dram_size(xgifb_info)) {
 		pr_err("Fatal error: Unable to determine RAM size.\n");
 		ret = -ENODEV;
-		goto error;
+		goto error_disable;
 	}
 
 	/* Enable PCI_LINEAR_ADDRESSING and MMIO_ENABLE  */
@@ -1956,7 +1956,7 @@ static int __devinit xgifb_probe(struct pci_dev *pdev,
 		pr_err("Fatal error: Unable to reserve frame buffer memory\n");
 		pr_err("Is there another framebuffer driver active?\n");
 		ret = -ENODEV;
-		goto error;
+		goto error_disable;
 	}
 
 	if (!request_mem_region(xgifb_info->mmio_base,
@@ -2271,6 +2271,8 @@ error_1:
 	release_mem_region(xgifb_info->mmio_base, xgifb_info->mmio_size);
 error_0:
 	release_mem_region(xgifb_info->video_base, xgifb_info->video_size);
+error_disable:
+	pci_disable_device(pdev);
 error:
 	framebuffer_release(fb_info);
 	return ret;
-- 
1.7.9.5


  parent reply	other threads:[~2012-06-06 14:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-06 14:22 [PATCH 1/4] Staging: xgifb: Remove #ifdef MODULE Miguel Gómez
2012-06-06 14:22 ` [PATCH 2/4] Staging: xgifb: reorder the code a bit to be more module friendly Miguel Gómez
2012-06-12  0:01   ` Greg KH
2012-06-18 10:52     ` Miguel Gómez
2012-06-06 14:22 ` Miguel Gómez [this message]
2012-06-06 14:22 ` [PATCH 4/4] Staging: xgifb: disable pci device on pci remove function Miguel Gómez

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=1338992527-5659-3-git-send-email-magomez@igalia.com \
    --to=magomez@igalia.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=arnaud.patard@rtp-net.org \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.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

all inboxes | Powered by JetHome®