linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] remove build warnings in windfarm_core
@ 2007-05-14  6:32 Stephen Rothwell
  2007-05-15  6:19 ` Paul Mackerras
  0 siblings, 1 reply; 10+ messages in thread
From: Stephen Rothwell @ 2007-05-14  6:32 UTC (permalink / raw)
  To: paulus, benh; +Cc: ppc-dev

drivers/macintosh/windfarm_core.c: In function 'wf_register_control':
drivers/macintosh/windfarm_core.c:219: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result
drivers/macintosh/windfarm_core.c: In function 'wf_register_sensor':
drivers/macintosh/windfarm_core.c:329: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 drivers/macintosh/windfarm_core.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index 192b26e..a306d67 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -198,14 +198,15 @@ static ssize_t wf_store_control(struct device *dev,
 int wf_register_control(struct wf_control *new_ct)
 {
 	struct wf_control *ct;
+	int ret = 0;
 
 	mutex_lock(&wf_lock);
 	list_for_each_entry(ct, &wf_controls, link) {
 		if (!strcmp(ct->name, new_ct->name)) {
 			printk(KERN_WARNING "windfarm: trying to register"
 			       " duplicate control %s\n", ct->name);
-			mutex_unlock(&wf_lock);
-			return -EEXIST;
+			ret = -EEXIST;
+			goto out_unlock;
 		}
 	}
 	kref_init(&new_ct->ref);
@@ -216,14 +217,21 @@ int wf_register_control(struct wf_control *new_ct)
 	new_ct->attr.attr.mode = 0644;
 	new_ct->attr.show = wf_show_control;
 	new_ct->attr.store = wf_store_control;
-	device_create_file(&wf_platform_device.dev, &new_ct->attr);
+	ret = device_create_file(&wf_platform_device.dev, &new_ct->attr);
+	if (ret) {
+		list_del(&new_ct->link);
+		printk(KERN_WARNING "windfarm: device_creat_file failed"
+			"for %s\n", new_ct->name);
+		goto out_unlock;
+	}
 
 	DBG("wf: Registered control %s\n", new_ct->name);
 
 	wf_notify(WF_EVENT_NEW_CONTROL, new_ct);
+out_unlock:
 	mutex_unlock(&wf_lock);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(wf_register_control);
 
@@ -308,14 +316,15 @@ static ssize_t wf_show_sensor(struct device *dev,
 int wf_register_sensor(struct wf_sensor *new_sr)
 {
 	struct wf_sensor *sr;
+	int ret;
 
 	mutex_lock(&wf_lock);
 	list_for_each_entry(sr, &wf_sensors, link) {
 		if (!strcmp(sr->name, new_sr->name)) {
 			printk(KERN_WARNING "windfarm: trying to register"
 			       " duplicate sensor %s\n", sr->name);
-			mutex_unlock(&wf_lock);
-			return -EEXIST;
+			ret = -EEXIST;
+			goto out_unlock;
 		}
 	}
 	kref_init(&new_sr->ref);
@@ -326,14 +335,21 @@ int wf_register_sensor(struct wf_sensor *new_sr)
 	new_sr->attr.attr.mode = 0444;
 	new_sr->attr.show = wf_show_sensor;
 	new_sr->attr.store = NULL;
-	device_create_file(&wf_platform_device.dev, &new_sr->attr);
+	ret = device_create_file(&wf_platform_device.dev, &new_sr->attr);
+	if (ret) {
+		list_del(&new_sr->link);
+		printk(KERN_WARNING "windfarm: device_create_file failed"
+		       " for %s\n", new_sr->name);
+		goto out_unlock;
+	}
 
 	DBG("wf: Registered sensor %s\n", new_sr->name);
 
 	wf_notify(WF_EVENT_NEW_SENSOR, new_sr);
+out_unlock:
 	mutex_unlock(&wf_lock);
 
-	return 0;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(wf_register_sensor);
 
-- 
1.5.1.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-05-18 11:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-14  6:32 [PATCH] [POWERPC] remove build warnings in windfarm_core Stephen Rothwell
2007-05-15  6:19 ` Paul Mackerras
2007-05-15  6:32   ` Segher Boessenkool
2007-05-15 16:45     ` Linas Vepstas
2007-05-16  1:24   ` Stephen Rothwell
2007-05-16 13:20     ` Segher Boessenkool
2007-05-16 14:10     ` Will Schmidt
2007-05-17  1:22     ` Stephen Rothwell
2007-05-17  1:26       ` Benjamin Herrenschmidt
2007-05-18 11:20       ` Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).