From: Andrew Morton Date: Mon, 10 Jul 2006 22:28:54 +0000 (-0700) Subject: [SPARC64]: of_device_register() error checking fix X-Git-Tag: v2.6.18-rc2~90^2~6 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cc8b6f51eb1af72882c279f691c5de7d5a43bf2;p=linux-2.6 [SPARC64]: of_device_register() error checking fix 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 Signed-off-by: David S. Miller --- diff --git a/arch/sparc/kernel/of_device.c b/arch/sparc/kernel/of_device.c index bc956c5303..bbd3203b86 100644 --- a/arch/sparc/kernel/of_device.c +++ b/arch/sparc/kernel/of_device.c @@ -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) diff --git a/arch/sparc64/kernel/of_device.c b/arch/sparc64/kernel/of_device.c index 169b017eec..8e177a0abc 100644 --- a/arch/sparc64/kernel/of_device.c +++ b/arch/sparc64/kernel/of_device.c @@ -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)