kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carlos Manuel Duclos Vergara <carlos@embedded.cl>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] pci-sh7751.c request_region return value check
Date: Sun, 27 Nov 2005 17:09:49 +0000	[thread overview]
Message-ID: <200511271409.50485.carlos@embedded.cl> (raw)
In-Reply-To: <200511262000.12480.carlos@embedded.cl>

[-- Attachment #1: Type: text/plain, Size: 134 bytes --]

Ok, thanks for your corrections. Attached is the new patch.

-- 
Carlos Manuel Duclos Vergara
http://www.toolchains.com/personal/blog

[-- Attachment #2: pci-sh7751.c.patch --]
[-- Type: text/x-diff, Size: 1003 bytes --]

--- Builds/linux-2.6.14.3/arch/sh/drivers/pci/pci-sh7751.c	2005-11-24 19:10:21.000000000 -0300
+++ Devel/linux-2.6.14.3/arch/sh/drivers/pci/pci-sh7751.c	2005-11-27 14:07:39.000000000 -0300
@@ -126,6 +126,7 @@
 static int __init pci_check_direct(void)
 {
 	unsigned int tmp, id;
+	struct resource *r = NULL;
 
 	/* check for SH7751/SH7751R hardware */
 	id = inl(SH7751_PCIREG_BASE+SH7751_PCICONF0);
@@ -144,7 +145,16 @@
 		if (inl (PCI_REG(SH7751_PCIPAR)) == 0x80000000) {
 			outl (tmp, PCI_REG(SH7751_PCIPAR));
 			printk(KERN_INFO "PCI: Using configuration type 1\n");
-			request_region(PCI_REG(SH7751_PCIPAR), 8, "PCI conf1");
+			r = request_region(PCI_REG(SH7751_PCIPAR), 8, "PCI conf1");
+			/*
+			 * Murphy's law....
+			 * (ENODEV or EINVAL in case of problems?)
+			 */
+			if( !r )
+			{
+				printk(KERN_CRIT "PCI: Could not allocate memory for our controller (Address: %lu)\n", PCI_REG(SH7751_PCIPAR));
+				return -ENODEV;
+			}
 			return 0;
 		}
 		outl (tmp, PCI_REG(SH7751_PCIPAR));

[-- Attachment #3: Type: text/plain, Size: 168 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

  parent reply	other threads:[~2005-11-27 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-26 23:00 [KJ] pci-sh7751.c request_region return value check Carlos Manuel Duclos Vergara
2005-11-27  0:04 ` Matthew Wilcox
2005-11-27 17:09 ` Carlos Manuel Duclos Vergara [this message]
2005-11-27 17:20 ` Nishanth Aravamudan

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=200511271409.50485.carlos@embedded.cl \
    --to=carlos@embedded.cl \
    --cc=kernel-janitors@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).