Skip to contentSkip to conversation

: Fix sysfs_create_file return value handling

PATCH New Tobias Klauser 1 participant 1 message Jun 13, 2007 CPU frequency scaling framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : Fix sysfs_create_file return value handling

Commit 0a4b2ccc555fa2ca6873d60219047104e4805d45 in cpufreq.git eliminates the build warnings but does not pass on the error code of sysfs_create_file to the function calling cpufreq_add_dev. Instead some previous value of ret would be returned.

drivers/cpufreq/cpufreq.c +6 -3
index 0521427..0db9e1b 100644
@@ -826,16 +826,19 @@ static int cpufreq_add_dev (struct sys_device * sys_dev)
 	/* set up files for this cpu device */
 	drv_attr = cpufreq_driver->attr;
 	while ((drv_attr) && (*drv_attr)) {
-		if (sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)))
+		ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
+		if (ret)
 			goto err_out_driver_exit;
 		drv_attr++;
 	}
 	if (cpufreq_driver->get){
-		if (sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr))
+		ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr);
+		if (ret)
 			goto err_out_driver_exit;
 	}
 	if (cpufreq_driver->target){
-		if (sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr))
+		ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr);
+		if (ret)
 			goto err_out_driver_exit;
 	}