Re: [PATCH] (2.5.66-mm2) War on warnings

Matthew Dobson (colpatch@us.ibm.com)
Tue, 01 Apr 2003 11:30:13 -0800


This is a MIME-formatted message. If you see this text it means that your
E-mail software does not support MIME-formatted messages.

--=_courier-12702-1049226014-0001-2
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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

--=_courier-12702-1049226014-0001-2
Content-Type: text/plain; name="sysfs_register_fix.patch"; charset=iso-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="sysfs_register_fix.patch"

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

--=_courier-12702-1049226014-0001-2--