mirror of
https://github.com/apache/nuttx.git
synced 2025-12-12 22:05:54 +08:00
bug fix: can_datahandler wrong return value
can_datahandler returns an unsigned value that represent the number of bytes actually bufffered, but the call to iob_tryadd_queue returns a negative value when it fails so that value can't be used as can_datahandler return value because it is interpreted as unsigned so a big number is wrongly returned when iob_tryadd_queue fails. The fix is just setting the return value to zero when iob_tryadd_queue fails, reflecting the actual meaning that no bytes have been buffered.
This commit is contained in:
committed by
Alan C. Assis
parent
d52ff33e78
commit
52dbfda355
@@ -234,6 +234,7 @@ uint16_t can_datahandler(FAR struct net_driver_s *dev,
|
||||
else
|
||||
{
|
||||
nerr("ERROR: Failed to queue the I/O buffer chain: %d\n", ret);
|
||||
ret = 0;
|
||||
goto errout;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user