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

remoteproc: Fix the NULL vs RPROC_IS_ERR() bug for remoteproc_get_rsc_table() #571

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

mengtanhzc
Copy link
Contributor

  • Since remoteproc_get_rsc_table() returns RPROC_ERR_PTR and never NULL, use RPROC_IS_ERR() to check the return value.

@glneo
Copy link
Contributor

glneo commented Mar 16, 2024

rsc_table is checked against NULL again down below in the error3: label. It might be cleaner to just update remoteproc_get_rsc_table() to return NULL on failure as all the current users of that function expect that.

@mengtanhzc
Copy link
Contributor Author

rsc_table is checked against NULL again down below in the error3: label. It might be cleaner to just update remoteproc_get_rsc_table() to return NULL on failure as all the current users of that function expect that.

I'll update remoteproc_get_rsc_table() later. Thanks for the review!

The rsc_table is checked against NULL in remoteproc_load().
But remoteproc_get_rsc_table() returns ERR_PTR after an error.
The error return value is unnecessary, just return NULL for failure.

Signed-off-by: Zongcheng Han <[email protected]>
@mengtanhzc
Copy link
Contributor Author

rsc_table is checked against NULL again down below in the error3: label. It might be cleaner to just update remoteproc_get_rsc_table() to return NULL on failure as all the current users of that function expect that.

I have updated the commit, please review it again. Thanks a lot.
And.. RPROC_ERR_PTR() is not in use, should I delete it?

@glneo
Copy link
Contributor

glneo commented Mar 16, 2024

And.. RPROC_ERR_PTR() is not in use, should I delete it?

I'd say yes. All these custom error codes are only used internally by the remoteproc framework, not sure why they exist at all. Everywhere else we just use the standard errno.h codes, and most of the RPROC_* are just copies of the same. We should start to look into just using the standard error codes and remove these custom error codes.

@arnopo
Copy link
Collaborator

arnopo commented Mar 25, 2024

And.. RPROC_ERR_PTR() is not in use, should I delete it?

I'd say yes. All these custom error codes are only used internally by the remoteproc framework, not sure why they exist at all. Everywhere else we just use the standard errno.h codes, and most of the RPROC_* are just copies of the same. We should start to look into just using the standard error codes and remove these custom error codes.

Agree. RPROC_PTR_ERR, RPROC_IS_ERR and RPROC_ERR_PTR can be removed as unused.
the Remoteproc error codes could also be remapped to metal errno.h code. In term we should not have specific error code in the Lib but used standard erno codes

Copy link
Collaborator

@danmilea danmilea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to merge.

@arnopo arnopo merged commit 04effe4 into OpenAMP:main Apr 2, 2024
3 checks passed
@arnopo arnopo added this to the Release V2024.04 milestone Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants