]> err.no Git - linux-2.6/commitdiff
[SPARC64]: of_device_register() error checking fix
authorAndrew Morton <akpm@osdl.org>
Mon, 10 Jul 2006 22:28:54 +0000 (15:28 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 13 Jul 2006 08:50:01 +0000 (01:50 -0700)
device_create_file() can fail.  This causes the sparc64 compile to
fail when my fanatical __must_check patch is applied, due to -Werror.

[ Added necessary identical fix for sparc32. -DaveM]

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/kernel/of_device.c
arch/sparc64/kernel/of_device.c

index bc956c5303764ccc1d4bdd87d271d4044aedff77..bbd3203b86af9429779a8ffde09b9711bfae8adf 100644 (file)
@@ -695,9 +695,11 @@ int of_device_register(struct of_device *ofdev)
        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)
index 169b017eec0b6c393f17096206db914dbff21ac2..8e177a0abc1c3d7e02f33492f2bc8d015b0730bb 100644 (file)
@@ -922,9 +922,11 @@ int of_device_register(struct of_device *ofdev)
        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)