LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PCMCIA] Check return status of register calls in i82365
@ 2004-05-21 11:55 Herbert Xu
  2004-05-21 23:41 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Herbert Xu @ 2004-05-21 11:55 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton, Linux Kernel Mailing List

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

Hi:

i82365 calls driver_register and platform_device_register without
checking their return values.  This patch fixes that.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 1399 bytes --]

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1808  -> 1.1809 
#	drivers/pcmcia/i82365.c	1.51    -> 1.52   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 04/05/21	herbert@gondor.apana.org.au	1.1809
# [PCMCIA] Check return status of register calls in i82365.
# --------------------------------------------
#
diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
--- a/drivers/pcmcia/i82365.c	Fri May 21 21:53:42 2004
+++ b/drivers/pcmcia/i82365.c	Fri May 21 21:53:42 2004
@@ -1372,8 +1372,15 @@
 {
     int i, ret;
 
-    if (driver_register(&i82365_driver))
-	return -1;
+    ret = driver_register(&i82365_driver);
+    if (ret)
+	return ret;
+
+    ret = platform_device_register(&i82365_device);
+    if (ret) {
+	driver_unregister(&i82365_driver);
+	return ret;
+    }
 
     printk(KERN_INFO "Intel ISA PCIC probe: ");
     sockets = 0;
@@ -1382,11 +1389,10 @@
 
     if (sockets == 0) {
 	printk("not found.\n");
+	platform_device_unregister(&i82365_device);
 	driver_unregister(&i82365_driver);
 	return -ENODEV;
     }
-
-    platform_device_register(&i82365_device);
 
     /* Set up interrupt handler(s) */
     if (grab_irq != 0)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PCMCIA] Check return status of register calls in i82365
  2004-05-21 11:55 [PCMCIA] Check return status of register calls in i82365 Herbert Xu
@ 2004-05-21 23:41 ` Andrew Morton
  2004-05-21 23:46   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2004-05-21 23:41 UTC (permalink / raw)
  To: Herbert Xu; +Cc: torvalds, linux-kernel

Herbert Xu <herbert@gondor.apana.org.au> wrote:
>
> i82365 calls driver_register and platform_device_register without
> checking their return values.  This patch fixes that.

It does more than that - you've also changed it to run platform_device_register()
prior to isa_probe().  How come?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PCMCIA] Check return status of register calls in i82365
  2004-05-21 23:41 ` Andrew Morton
@ 2004-05-21 23:46   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2004-05-21 23:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: torvalds, linux-kernel

On Fri, May 21, 2004 at 04:41:11PM -0700, Andrew Morton wrote:
> Herbert Xu <herbert@gondor.apana.org.au> wrote:
> >
> > i82365 calls driver_register and platform_device_register without
> > checking their return values.  This patch fixes that.
> 
> It does more than that - you've also changed it to run platform_device_register()
> prior to isa_probe().  How come?

1. The platform device being registered is a place-holder that does not
   rely on the probing at all.
2. If it was done after the probe then should the registration fail, we'll
   have to roll back all the changes done by isa_probe().

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-05-22  0:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-21 11:55 [PCMCIA] Check return status of register calls in i82365 Herbert Xu
2004-05-21 23:41 ` Andrew Morton
2004-05-21 23:46   ` Herbert Xu

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).