public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: "Martin J. Bligh" <mbligh@aracnet.com>
Cc: Jeff Garzik <jgarzik@pobox.com>, Andrew Morton <akpm@digeo.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] (2.5.66-mm2) War on warnings
Date: Tue, 01 Apr 2003 11:30:13 -0800	[thread overview]
Message-ID: <3E89E8C5.40300@us.ibm.com> (raw)
In-Reply-To: 25070000.1049213622@[10.10.2.4]

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

Martin J. Bligh wrote:
>>Personally, I feel statements like these are prone to continual error
>>and confusion.  I would prefer to break each test like this out into
>>separate assignment and test statements.  Combining them decreases
>>readability, while saving a paltry few extra bytes of source code.
>>
>>Sure, the gcc warning is silly, but the code is a bit obtuse too.
> 
> 
> True, I agree with this in general, and I think Andrew does too, from
> previous comments. I was just being lazy ;-) More appropriate patch below.
> Compile tested, but not run.
> 
> M.

Ok...  drivers/base/cpu.c had the double parens, unlike memblkc. & 
node.c  This patch will make them all more readable and consistent...

Down with warnings!!  We must liberate them, and set them free! ;)

-Matt

[-- Attachment #2: sysfs_register_fix.patch --]
[-- Type: text/plain, Size: 1947 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.66-mm2/drivers/base/cpu.c linux-2.5.66-mm2+warnfix/drivers/base/cpu.c
--- linux-2.5.66-mm2/drivers/base/cpu.c	Tue Apr  1 11:22:06 2003
+++ linux-2.5.66-mm2+warnfix/drivers/base/cpu.c	Tue Apr  1 11:26:21 2003
@@ -49,8 +49,12 @@
 int __init cpu_dev_init(void)
 {
 	int error;
-	if (!(error = devclass_register(&cpu_devclass)))
-		if ((error = driver_register(&cpu_driver)))
+
+	error = devclass_register(&cpu_devclass);
+	if (!error) {
+		error = driver_register(&cpu_driver);
+		if (error)
 			devclass_unregister(&cpu_devclass);
+	}
 	return error;
 }
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.66-mm2/drivers/base/memblk.c linux-2.5.66-mm2+warnfix/drivers/base/memblk.c
--- linux-2.5.66-mm2/drivers/base/memblk.c	Tue Apr  1 11:22:06 2003
+++ linux-2.5.66-mm2+warnfix/drivers/base/memblk.c	Tue Apr  1 11:24:51 2003
@@ -50,9 +50,13 @@
 int __init register_memblk_type(void)
 {
 	int error;
-	if (!(error = devclass_register(&memblk_devclass)))
-		if (error = driver_register(&memblk_driver))
+
+	error = devclass_register(&memblk_devclass);
+	if (!error) {
+		error = driver_register(&memblk_driver);
+		if (error)
 			devclass_unregister(&memblk_devclass);
+	}
 	return error;
 }
 postcore_initcall(register_memblk_type);
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.66-mm2/drivers/base/node.c linux-2.5.66-mm2+warnfix/drivers/base/node.c
--- linux-2.5.66-mm2/drivers/base/node.c	Tue Apr  1 11:22:06 2003
+++ linux-2.5.66-mm2+warnfix/drivers/base/node.c	Tue Apr  1 11:24:51 2003
@@ -92,9 +92,13 @@
 int __init register_node_type(void)
 {
 	int error;
-	if (!(error = devclass_register(&node_devclass)))
-		if (error = driver_register(&node_driver))
+	
+	error = devclass_register(&node_devclass);
+	if (!error) {
+		error = driver_register(&node_driver);
+		if (error)
 			devclass_unregister(&node_devclass);
+	}
 	return error;
 }
 postcore_initcall(register_node_type);

  parent reply	other threads:[~2003-04-01 19:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-01 15:22 [PATCH] (2.5.66-mm2) War on warnings Martin J. Bligh
2003-04-01 15:27 ` Jeff Garzik
2003-04-01 16:13   ` Martin J. Bligh
2003-04-01 18:37     ` Matthew Dobson
2003-04-01 19:30     ` Matthew Dobson [this message]
2003-04-01 19:32     ` Matthew Dobson
2003-04-01 19:36       ` Martin J. Bligh
2003-04-01 16:14   ` Juan Quintela

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=3E89E8C5.40300@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    /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