Skip to content

Commit

Permalink
[SPARC64]: of_device_register() error checking fix
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Morton authored and David S. Miller committed Jul 13, 2006
1 parent e47f317 commit 6cc8b6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions arch/sparc/kernel/of_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions arch/sparc64/kernel/of_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6cc8b6f

Please sign in to comment.