linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch][trivial] fix drivers/base/cpu.c
@ 2003-01-22 23:52 Matthew Dobson
  2003-01-29  4:51 ` Rusty Russell
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Dobson @ 2003-01-22 23:52 UTC (permalink / raw)
  To: linux-kernel
  Cc: William Lee Irwin III, Martin J. Bligh, Michael Hohnbaum,
	Trivial Patch Monkey

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

Both drivers/base/node.c & memblk.c check the return values of the 
devclass_register & driver_register calls.  cpu.c doesn't.  This little 
patch remedies that omission.

[mcd@arrakis push]$ diffstat sysfs_topo_cleanup-2.5.59.patch
  cpu.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

Cheers!

-Matt

[-- Attachment #2: sysfs_topo_cleanup-2.5.59.patch --]
[-- Type: text/plain, Size: 558 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.58-vanilla/drivers/base/cpu.c linux-2.5.58-topo_cleanup/drivers/base/cpu.c
--- linux-2.5.58-vanilla/drivers/base/cpu.c	Mon Jan 13 21:58:28 2003
+++ linux-2.5.58-topo_cleanup/drivers/base/cpu.c	Thu Jan 16 16:48:23 2003
@@ -48,7 +48,7 @@
 
 static int __init register_cpu_type(void)
 {
-	devclass_register(&cpu_devclass);
-	return driver_register(&cpu_driver);
+	int error = devclass_register(&cpu_devclass);
+	return error ? error : driver_register(&cpu_driver);
 }
 postcore_initcall(register_cpu_type);

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

* Re: [patch][trivial] fix drivers/base/cpu.c
  2003-01-22 23:52 [patch][trivial] fix drivers/base/cpu.c Matthew Dobson
@ 2003-01-29  4:51 ` Rusty Russell
  2003-01-29  5:55   ` William Lee Irwin III
  0 siblings, 1 reply; 4+ messages in thread
From: Rusty Russell @ 2003-01-29  4:51 UTC (permalink / raw)
  To: colpatch
  Cc: linux-kernel, William Lee Irwin III, Martin J. Bligh, Michael Hohnbaum

In message <3E2F2EC1.4090606@us.ibm.com> you write:
> This is a multi-part message in MIME format.
> --------------050105040306060502000102
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
> 
> Both drivers/base/node.c & memblk.c check the return values of the 
> devclass_register & driver_register calls.  cpu.c doesn't.  This little 
> patch remedies that omission.

You'd want to to undo the devclass_register() on failure, too, I
imagine.

Rusty.
--
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

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

* Re: [patch][trivial] fix drivers/base/cpu.c
  2003-01-29  4:51 ` Rusty Russell
@ 2003-01-29  5:55   ` William Lee Irwin III
  2003-01-29 18:19     ` Matthew Dobson
  0 siblings, 1 reply; 4+ messages in thread
From: William Lee Irwin III @ 2003-01-29  5:55 UTC (permalink / raw)
  To: Rusty Russell; +Cc: colpatch, linux-kernel, Martin J. Bligh, Michael Hohnbaum

In message <3E2F2EC1.4090606@us.ibm.com> Matt Dobson (?) wrote:
>> Both drivers/base/node.c & memblk.c check the return values of the 
>> devclass_register & driver_register calls.  cpu.c doesn't.  This little 
>> patch remedies that omission.

On Wed, Jan 29, 2003 at 03:51:04PM +1100, Rusty Russell wrote:
> You'd want to to undo the devclass_register() on failure, too, I
> imagine.

Ow, I forgot about that. Someone grind this out quick and take care of
the other oopsing thingies. You know what I'm preoccupied with.


-- wli

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

* Re: [patch][trivial] fix drivers/base/cpu.c
  2003-01-29  5:55   ` William Lee Irwin III
@ 2003-01-29 18:19     ` Matthew Dobson
  0 siblings, 0 replies; 4+ messages in thread
From: Matthew Dobson @ 2003-01-29 18:19 UTC (permalink / raw)
  To: William Lee Irwin III
  Cc: Rusty Russell, linux-kernel, Martin J. Bligh, Michael Hohnbaum

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

William Lee Irwin III wrote:
> In message <3E2F2EC1.4090606@us.ibm.com> Matt Dobson (?) wrote:
> 
>>>Both drivers/base/node.c & memblk.c check the return values of the 
>>>devclass_register & driver_register calls.  cpu.c doesn't.  This little 
>>>patch remedies that omission.
>>
> 
> On Wed, Jan 29, 2003 at 03:51:04PM +1100, Rusty Russell wrote:
> 
>>You'd want to to undo the devclass_register() on failure, too, I
>>imagine.
> 
> 
> Ow, I forgot about that. Someone grind this out quick and take care of
> the other oopsing thingies. You know what I'm preoccupied with.
> 
> -- wli

Good point Rusty, cleanup attatched...

Cheers!

-Matt

[-- Attachment #2: sysfs_topo_cleanup-2.5.59.patch --]
[-- Type: text/plain, Size: 2005 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.59-vanilla/drivers/base/cpu.c linux-2.5.59-driver_base_cleanup/drivers/base/cpu.c
--- linux-2.5.59-vanilla/drivers/base/cpu.c	Thu Jan 16 18:21:51 2003
+++ linux-2.5.59-driver_base_cleanup/drivers/base/cpu.c	Wed Jan 29 10:16:26 2003
@@ -48,7 +48,10 @@
 
 static int __init register_cpu_type(void)
 {
-	devclass_register(&cpu_devclass);
-	return driver_register(&cpu_driver);
+	int error;
+	if (!(error = devclass_register(&cpu_devclass)))
+		if (error = driver_register(&cpu_driver))
+			devclass_unregister(&cpu_devclass);
+	return error;
 }
 postcore_initcall(register_cpu_type);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.59-vanilla/drivers/base/memblk.c linux-2.5.59-driver_base_cleanup/drivers/base/memblk.c
--- linux-2.5.59-vanilla/drivers/base/memblk.c	Thu Jan 16 18:22:57 2003
+++ linux-2.5.59-driver_base_cleanup/drivers/base/memblk.c	Wed Jan 29 10:16:08 2003
@@ -49,7 +49,10 @@
 
 static int __init register_memblk_type(void)
 {
-	int error = devclass_register(&memblk_devclass);
-	return error ? error : driver_register(&memblk_driver);
+	int error;
+	if (!(error = devclass_register(&memblk_devclass)))
+		if (error = driver_register(&memblk_driver))
+			devclass_unregister(&memblk_devclass);
+	return error;
 }
 postcore_initcall(register_memblk_type);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.59-vanilla/drivers/base/node.c linux-2.5.59-driver_base_cleanup/drivers/base/node.c
--- linux-2.5.59-vanilla/drivers/base/node.c	Thu Jan 16 18:21:40 2003
+++ linux-2.5.59-driver_base_cleanup/drivers/base/node.c	Wed Jan 29 10:15:12 2003
@@ -91,7 +91,10 @@
 
 static int __init register_node_type(void)
 {
-	int error = devclass_register(&node_devclass);
-	return error ? error : driver_register(&node_driver);
+	int error;
+	if (!(error = devclass_register(&node_devclass)))
+		if (error = driver_register(&node_driver))
+			devclass_unregister(&node_devclass);
+	return error;
 }
 postcore_initcall(register_node_type);

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

end of thread, other threads:[~2003-01-29 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22 23:52 [patch][trivial] fix drivers/base/cpu.c Matthew Dobson
2003-01-29  4:51 ` Rusty Russell
2003-01-29  5:55   ` William Lee Irwin III
2003-01-29 18:19     ` Matthew Dobson

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