Thread (8 messages) 8 messages, 4 authors, 2007-06-25

Re: [patch] powerpc: sysfs fix compiler warning

From: Josh Boyer <hidden>
Date: 2007-06-22 19:12:05

On Fri, 2007-06-22 at 23:09 +0400, Sergei Shtylyov wrote:
Josh Boyer wrote:
quoted
On Fri, 2007-06-22 at 22:57 +0400, Sergei Shtylyov wrote:
quoted
Hello.

Josh Boyer wrote:

quoted
quoted
From: Christian Krafft <redacted>
quoted
quoted
This patch fixes the following compiler warning:
arch/powerpc/kernel/sysfs.c:385: warning: ignoring return value of
`sysfs_create_group',
quoted
quoted
Signed-off-by: Christian Krafft <redacted>
quoted
quoted
Index: linux-2.6.22-rc5/arch/powerpc/kernel/sysfs.c
===================================================================
--- linux-2.6.22-rc5.orig/arch/powerpc/kernel/sysfs.c
+++ linux-2.6.22-rc5/arch/powerpc/kernel/sysfs.c
@@ -380,16 +380,23 @@ int cpu_add_sysdev_attr_group(struct att
{
int cpu;
struct sys_device *sysdev;
+	int error;

mutex_lock(&cpu_mutex);

for_each_possible_cpu(cpu) {
	sysdev = get_cpu_sysdev(cpu);
-		sysfs_create_group(&sysdev->kobj, attrs);
+		error |= sysfs_create_group(&sysdev->kobj, attrs);
quoted
quoted
quoted
Why are you or'ing the return value with whatever is in the
uninitialized variable?
quoted
quoted
   To make it always fail, no doubt. ;-)
   ISO accumulation error, it makes more sense to start cleanup created 
groups right after the first creation failure -- although with the callers opf 
this function ignoring the result anyway, who cares. :-)
quoted
I care because he does an if (error) below that.  Since error isn't
initialized, it could be some random value and or'ing a 0 return code
from sysfs_create_group would still trigger the error path.
quoted
Plus, it's bogus anyway and should be fixed.
    You misunderstood: I didn't at all object to fixing the bogosity you've 
pointed out, just mused about how/if the error cleanup should be done.
Ah, gotcha.  Sorry, it's Friday and I shouldn't be here ;)

josh
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help