[Cbe-oss-dev] [patch 10/13] powerpc: sysfs fix compiler warning

Andrew Morton akpm at linux-foundation.org
Thu Jul 19 05:56:25 EST 2007


On Wed, 18 Jul 2007 18:04:49 +0200
Arnd Bergmann <arnd at arndb.de> wrote:

> From: Christian Krafft <krafft at de.ibm.com>
> This patch fixes the following compiler warning:
> arch/powerpc/kernel/sysfs.c:385: warning: ignoring return value of
> `sysfs_create_group',
> 
> Signed-off-by: Christian Krafft <krafft at de.ibm.com>
> Signed-off-by: Arnd Bergmann <arnd.bergmann at de.ibm.com>
> 
> Index: linux-2.6/arch/powerpc/kernel/sysfs.c
> ===================================================================
> --- linux-2.6.orig/arch/powerpc/kernel/sysfs.c
> +++ linux-2.6/arch/powerpc/kernel/sysfs.c
> @@ -380,16 +380,25 @@ int cpu_add_sysdev_attr_group(struct att
>  {
>  	int cpu;
>  	struct sys_device *sysdev;
> +	int error = 0;
>  
>  	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);
> +
> +		if (error) {
> +			for_each_possible_cpu(cpu) {
> +				sysdev = get_cpu_sysdev(cpu);
> +				sysfs_remove_group(&sysdev->kobj, attrs);
> +			}
> +			break;
> +		}
>  	}
>  
>  	mutex_unlock(&cpu_mutex);
> -	return 0;
> +	return error;
>  }
>  EXPORT_SYMBOL_GPL(cpu_add_sysdev_attr_group);

This will attempt to remove groups which were never added.  I don't know
what will happen then.



More information about the cbe-oss-dev mailing list