From: "Darren Jenkins\\" <darrenrjenkins@gmail.com>
To: kernel-janitors@vger.kernel.org
Subject: Re: [KJ][Patch] check return value of request_irq in i82365.c
Date: Tue, 14 Mar 2006 08:44:37 +0000 [thread overview]
Message-ID: <1142325878.8718.8.camel@localhost.localdomain> (raw)
In-Reply-To: <1141029654.7765.6.camel@localhost.localdomain>
[-- Attachment #1: Type: text/plain, Size: 3405 bytes --]
On Mon, 2006-03-13 at 13:29 +0100, Tobias Klauser wrote:
> > /* Set up interrupt handler(s) */
> > if (grab_irq != 0)
> > - request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt);
> > + if (request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt)< 0)
> > + {
> ^-- You might want to have this on the above line as with the if's
> before. Also a space before the '<' would be good.
>
> Cheers, Tobias
OK here is the patch with your change, doing it on two lines like this
was the best I could make it look in 80 cols.
Also I noticed another problem where isa_probe() might or might not
succeed with a request_region() meaning that we might release_region()
on something we don't own. The patch below fixes this too.
If this patch is OK I will follow with the coding style clean up.
Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
--- linux-2.6.16-rc5/drivers/pcmcia/i82365.c.orig 2006-03-13 17:49:26.000000000 +1100
+++ linux-2.6.16-rc5/drivers/pcmcia/i82365.c 2006-03-14 19:27:39.000000000 +1100
@@ -770,7 +770,7 @@ MODULE_DEVICE_TABLE(isapnp, id_table);
static struct pnp_dev *i82365_pnpdev;
#endif
-static void __init isa_probe(void)
+static int __init isa_probe(void)
{
int i, j, sock, k, ns, id;
kio_addr_t port;
@@ -805,7 +805,7 @@ static void __init isa_probe(void)
if (!request_region(i365_base, 2, "i82365")) {
if (sockets == 0)
printk("port conflict at %#lx\n", i365_base);
- return;
+ return -EBUSY;
}
id = identify(i365_base, 0);
@@ -844,6 +844,7 @@ static void __init isa_probe(void)
if (ns != 0) add_pcic(ns, id);
}
}
+ return 0;
}
/*====================================================================*/
@@ -1264,37 +1265,37 @@ static int __init init_i82365(void)
ret = driver_register(&i82365_driver);
if (ret)
- return ret;
+ goto out;
i82365_device = platform_device_alloc("i82365", 0);
- if (i82365_device) {
- ret = platform_device_add(i82365_device);
- if (ret)
- platform_device_put(i82365_device);
- } else
- ret = -ENOMEM;
-
- if (ret) {
- driver_unregister(&i82365_driver);
- return ret;
+ if (!i82365_device) {
+ ret = -ENOMEM;
+ goto ur_out;
}
+
+ ret = platform_device_add(i82365_device);
+ if (ret)
+ goto pdp_out;
printk(KERN_INFO "Intel ISA PCIC probe: ");
sockets = 0;
- isa_probe();
+ i = isa_probe();
if (sockets == 0) {
printk("not found.\n");
- platform_device_unregister(i82365_device);
- release_region(i365_base, 2);
- driver_unregister(&i82365_driver);
- return -ENODEV;
+ ret = -ENODEV;
+ goto r_out;
}
/* Set up interrupt handler(s) */
if (grab_irq != 0)
- request_irq(cs_irq, pcic_interrupt, 0, "i82365", pcic_interrupt);
+ if (request_irq(cs_irq, pcic_interrupt, 0, "i82365",
+ pcic_interrupt) < 0){
+ printk(KERN_ERR "init_i82365 could not request_irq");
+ ret = -EBUSY;
+ goto r_out;
+ }
/* register sockets with the pcmcia core */
for (i = 0; i < sockets; i++) {
@@ -1325,6 +1326,17 @@ static int __init init_i82365(void)
}
return 0;
+
+r_out:
+ if (i == 0)
+ release_region(i365_base, 2);
+ platform_device_del(i82365_device);
+pdp_out:
+ platform_device_put(i82365_device);
+ur_out:
+ driver_unregister(&i82365_driver);
+out:
+ return ret;
} /* init_i82365 */
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2006-03-14 8:44 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-27 8:40 [KJ][Patch] check return value of request_region in matroxfb_base.c Darren Jenkins\
2006-03-01 7:12 ` [KJ][Patch] check return value of request region in ali5455.c Darren Jenkins\
2006-03-03 6:31 ` [KJ][Patch] check return value of request_region in Petr Vandrovec
2006-03-11 13:48 ` [KJ][Patch] check return value of request_irq in amiserial.c Darren Jenkins\
2006-03-13 4:37 ` [KJ][Patch] check return value of request_irq in pcnet_cs.c Darren Jenkins\
2006-03-13 5:00 ` Randy.Dunlap
2006-03-13 5:16 ` Darren Jenkins\
2006-03-13 5:27 ` Randy.Dunlap
2006-03-13 6:16 ` Darren Jenkins\
2006-03-13 11:56 ` [KJ][Patch] check return value of request_irq in i82365.c Darren Jenkins\
2006-03-13 12:29 ` Tobias Klauser
2006-03-14 8:44 ` Darren Jenkins\ [this message]
2006-03-14 16:26 ` Randy.Dunlap
2006-03-15 7:02 ` Darren Jenkins\
2006-03-15 7:32 ` Nishanth Aravamudan
2006-03-15 12:46 ` [KJ][Patch] check return value of request_region and request_irq Darren Jenkins\
2006-03-15 12:57 ` Tobias Klauser
2006-03-16 10:45 ` [KJ][Patch] check return value of request_region and Darren Jenkins\
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=1142325878.8718.8.camel@localhost.localdomain \
--to=darrenrjenkins@gmail.com \
--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.