[PATCH 2.6.19-rc6] powerpc: fix of_device __must_check warning

Ryusuke Konishi ryusuke at osrg.net
Wed Nov 29 16:07:51 EST 2006


This fixes the following compile warning:

arch/powerpc/kernel/of_device.c: In function 'of_device_register':
arch/powerpc/kernel/of_device.c:199: warning: ignoring return value of 'device_create_file', declared with attribute warn_unused_result

Signed-off-by: Ryusuke Konishi <ryusuke at osrg.net>
---
Hi,

This patch becomes useless when Benjamin's "powerpc: of_platform 
improvements" work will be done.  But, transiently, it helps to 
reduce gcc warning arising on the latest Linus's tree.

Regards,

Ryusuke

diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 397c83e..8831f00 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -196,9 +196,11 @@ int of_device_register(struct of_device
 	if (rc)
 		return rc;
 
-	device_create_file(&ofdev->dev, &dev_attr_devspec);
+	rc = device_create_file(&ofdev->dev, &dev_attr_devspec);
+	if (rc)
+		device_unregister(&ofdev->dev);
 
-	return 0;
+	return rc;
 }
 
 void of_device_unregister(struct of_device *ofdev)



More information about the Linuxppc-dev mailing list