DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Question: typedef of eventdev_info_get_t bug?
@ 2021-02-01  9:21 Fredrik A Lindgren
  2021-02-01  9:44 ` Van Haaren, Harry
  0 siblings, 1 reply; 6+ messages in thread
From: Fredrik A Lindgren @ 2021-02-01  9:21 UTC (permalink / raw)
  To: dev

While debugging a driver I was looking at the code and realized that eventdev_info_get_t typedef is defined with void return value but documentation for it says it should return 0

lib/librte_eventdev/eventdev_pmd.h:

...
* @return
*   Returns 0 on success
*/
typedef void (*eventdev_info_get_t)(struct rte_eventdev *dev,
                                                          struct rte_event_dev_info *dev_info);
...
struct rte_eventdev_ops {
                             eventdev_info_get_t dev_infos_get;              /**< Get device info. */
...

While return value from it is used in lib/librte_ethdev/rte_ethdev.c:

int
rte_eth_dev_info_get(uint16_t port_id, struct rte_eth_dev_info *dev_info)
...
   diag = (*dev->dev_ops->dev_infos_get)(dev, dev_info);
   if (diag != 0) {
...


Driver I'm debugging doesn't have any return statement in it's dev_infos_get function which seems to cause it to have "result" of last operation done in that function as return value.
Though this behavior may be compiler specific but it should probably be clarified and updated (change prototype of stop using return value) to avoid issue with it.

Br,
Fredrik

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-01 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01  9:21 [dpdk-dev] Question: typedef of eventdev_info_get_t bug? Fredrik A Lindgren
2021-02-01  9:44 ` Van Haaren, Harry
2021-02-01 10:02   ` Fredrik A Lindgren
2021-02-01 10:31     ` Van Haaren, Harry
2021-02-01 12:49       ` Fredrik A Lindgren
2021-02-01 13:23         ` Van Haaren, Harry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).