[PATCH 2.6.19-rc6] powerpc: fix of_device __must_check warning
Ryusuke Konishi
ryusuke at osrg.net
Thu Nov 30 23:39:58 EST 2006
Hi,
Paul Mackerras wrote:
> Your patch also makes a policy change, though, in that without your
> patch, a failure in creating the "devspec" file in sysfs doesn't
> prevent of_device_register from performing its main function. With
> your patch, of_device_register will fail if we can't create the
> "devspec" file.
>
> On the whole, I am inclined to think that it is useful for
> of_device_register to succeed even if the devspec file can't be
> created, since nothing in the kernel relies on the devspec file being
> present.
>
> Paul.
Yes, you have a point there.
For the purpose of reference, I looked into other architectures.
Then, I found that sparc (and sparc64) had same of_device_register()
functions, and both are checking the result of device_create_file()
as follows.
in function arch/sparc/kernel/of_device.c:
>int of_device_register(struct of_device *ofdev)
>{
> int rc;
>
> BUG_ON(ofdev->node == NULL);
>
> rc = device_register(&ofdev->dev);
> if (rc)
> return rc;
>
> rc = device_create_file(&ofdev->dev, &dev_attr_devspec);
> if (rc)
> device_unregister(&ofdev->dev);
>
> return rc;
>}
But then, I'd like to respect your point of view,
and I won't stick to this case example.
Ryusuke.
More information about the Linuxppc-dev
mailing list