All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard <h.vanberkum@chello.nl>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ] [PATCH] drivers/char/mxser.c: check request_region()
Date: Tue, 04 Jul 2006 00:01:39 +0000	[thread overview]
Message-ID: <44A9CDC7.3000702@chello.nl> (raw)
In-Reply-To: <44A9BD91.4010002@chello.nl>

Randy.Dunlap wrote:

> Thanks... but I missed one more:  use space before '{'

Okay
> 
> And send it to the mailing list...

I did resend it later when I realized I forgot the mailing list
> 

Signed-off-by: Richard van Berkum <h.vanberkum at chello.nl>


--- janitor-2.6/drivers/char/mxser.c	2006-07-01 11:54:45.895077096 +0200
+++ mytree/drivers/char/mxser.c	2006-07-04 02:52:17.965040344 +0200
@@ -642,16 +642,24 @@ static int mxser_get_PCI_conf(int busnum
 	hwconf->board_type = board_type;
 	hwconf->ports = mxser_numports[board_type - 1];
 	ioaddress = pci_resource_start(pdev, 2);
-	request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2),
-			"mxser(IO)");
+	if (!(request_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2),
+			"mxser(IO)"))) {
+		printk(KERN_ERR "mxser: I/O ports already in use\n");
+		return -EIO;
+	}
+

 	for (i = 0; i < hwconf->ports; i++)
 		hwconf->ioaddr[i] = ioaddress + 8 * i;

 	/* vector */
 	ioaddress = pci_resource_start(pdev, 3);
-	request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3),
-			"mxser(vector)");
+	if (!(request_region(pci_resource_start(pdev, 3), pci_resource_len(pdev, 3),
+			"mxser(vector)"))) {
+		printk(KERN_ERR "mxser: I/O ports already in use\n");
+		goto out;
+	}
+	
 	hwconf->vector = ioaddress;

 	/* irq */
@@ -691,6 +699,10 @@ static int mxser_get_PCI_conf(int busnum
 		hwconf->baud_base[i] = 921600;
 	}
 	return 0;
+out:
+	release_region(pci_resource_start(pdev, 2), pci_resource_len(pdev, 2));
+	return -EIO;
+
 }
 #endif

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

      parent reply	other threads:[~2006-07-04  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03 22:52 [KJ] [PATCH] drivers/char/mxser.c: check request_region() Richard
2006-07-03 23:12 ` Randy.Dunlap
2006-07-03 23:30 ` Richard
2006-07-04  0:01 ` Richard [this message]

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=44A9CDC7.3000702@chello.nl \
    --to=h.vanberkum@chello.nl \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.