Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide Linux-style IS_ERR()/PTR_ERR()/ERR_PTR() helpers #22636

Closed
jhedberg opened this issue Feb 8, 2020 · 1 comment
Closed

Provide Linux-style IS_ERR()/PTR_ERR()/ERR_PTR() helpers #22636

jhedberg opened this issue Feb 8, 2020 · 1 comment
Labels
area: Kernel Feature Request A request for a new feature

Comments

@jhedberg
Copy link
Member

jhedberg commented Feb 8, 2020

Linux has a very convenient feature of being able to encode POSIX error codes into pointers. This helps create simpler APIs where a pointer is returned but specific error information (beyond NULL return) is also required.

For reference:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/err.h

The above is a single implementation used for all architectures, but we may want to consider doing per-architecture header files in case Zephyr supports some architecture with special requirements.

@jhedberg jhedberg added Feature Request A request for a new feature area: Kernel labels Feb 8, 2020
@jhedberg jhedberg changed the title Provide Linux-style IS_ERR()/PTR_ERR()/ERR_PTR() helpers Provide Linux-style IS_ERR()/PTR_ERR()/ERR_PTR() helpers Feb 8, 2020
@jhedberg
Copy link
Member Author

jhedberg commented Feb 8, 2020

Duplicate of #4973

@jhedberg jhedberg marked this as a duplicate of #4973 Feb 8, 2020
@jhedberg jhedberg closed this as completed Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel Feature Request A request for a new feature
Projects
None yet
Development

No branches or pull requests

1 participant