OpenAMP / open-amp

The main OpenAMP library implementing RPMSG, Virtio, and Remoteproc for RTOS etc
https://www.openampproject.org/
Other
678 stars 278 forks source link

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

Closed mengtanhzc closed 3 months ago

mengtanhzc commented 3 months ago
glneo commented 3 months ago

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 commented 3 months ago

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!

mengtanhzc commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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_PTRcan 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