mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
can: propagate iob_tryadd_queue() failure in can_datahandler
The can_datahandler() function calls iob_tryadd_queue() to enqueue received CAN data. Since iob_tryadd_queue() may return a negative value on failure, the error was previously not properly handled. Update can_datahandler() to propagate the return value so callers can detect and handle queueing failures correctly. Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
This commit is contained in:
committed by
Michal Lenc
parent
e3403709f8
commit
f53b986fb2
+4
-4
@@ -254,8 +254,8 @@ uint32_t can_callback(FAR struct net_driver_s *dev,
|
|||||||
* conn - A pointer to the CAN connection structure
|
* conn - A pointer to the CAN connection structure
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* The number of bytes actually buffered is returned. This will be either
|
* The number of bytes actually buffered is returned. This will be
|
||||||
* zero or equal to buflen; partial packets are not buffered.
|
* negative or zero or equal to buflen; partial packets are not buffered.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
* - The caller has checked that CAN_NEWDATA is set in flags and that is no
|
* - The caller has checked that CAN_NEWDATA is set in flags and that is no
|
||||||
@@ -264,8 +264,8 @@ uint32_t can_callback(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint16_t can_datahandler(FAR struct net_driver_s *dev,
|
int can_datahandler(FAR struct net_driver_s *dev,
|
||||||
FAR struct can_conn_s *conn);
|
FAR struct can_conn_s *conn);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: can_recvmsg
|
* Name: can_recvmsg
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ can_data_event(FAR struct net_driver_s *dev, FAR struct can_conn_s *conn,
|
|||||||
uint32_t flags)
|
uint32_t flags)
|
||||||
{
|
{
|
||||||
int buflen = dev->d_len;
|
int buflen = dev->d_len;
|
||||||
uint16_t recvlen;
|
int recvlen;
|
||||||
uint32_t ret;
|
uint32_t ret;
|
||||||
|
|
||||||
#ifdef CONFIG_NET_TIMESTAMP
|
#ifdef CONFIG_NET_TIMESTAMP
|
||||||
@@ -193,8 +193,8 @@ uint32_t can_callback(FAR struct net_driver_s *dev,
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
uint16_t can_datahandler(FAR struct net_driver_s *dev,
|
int can_datahandler(FAR struct net_driver_s *dev,
|
||||||
FAR struct can_conn_s *conn)
|
FAR struct can_conn_s *conn)
|
||||||
{
|
{
|
||||||
FAR struct iob_s *iob = dev->d_iob;
|
FAR struct iob_s *iob = dev->d_iob;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user