This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 16e80f19e8921ec9c2702f1101be3b9e2552174d
Author: zhanghongyu <[email protected]>
AuthorDate: Sun Nov 22 09:31:21 2026 +0800

    net/can: Fix the build with CONFIG_NET_CAN_NBUFFERS enabled.
    
    can_bufpool.c did not compile when the CAN buffer pool was enabled:
    
      can/can_bufpool.c:103:19: warning: implicit declaration of function
        'mempool_zallocate_throttled'
      can/can_bufpool.c:140:28: error: 'throttled' undeclared (first use in
        this function)
    
    can_iob_timedalloc() allocated with mempool_zallocate_throttled(), but
    the pool is declared with NET_BUFPOOL_DECLARE() and that function does
    not exist here.  Allocate with NET_BUFPOOL_TIMEDALLOC() to match the
    pool, and mark the throttled argument unused, as the pool has no
    throttling.  The buffer still starts cleared because
    iob_init_with_data() clears the header.
    
    can_iob_clone() passed a throttled variable that is not in its scope.
    It takes no such parameter upstream, so pass false, which is what the
    can_iob_clone() fallback macro does when the pool is disabled.
    
    Assisted-by: Kiro:claude-opus-5
    Signed-off-by: zhanghongyu <[email protected]>
---
 net/can/can_bufpool.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/can/can_bufpool.c b/net/can/can_bufpool.c
index a2752e3900c..cdf22a3fc1d 100644
--- a/net/can/can_bufpool.c
+++ b/net/can/can_bufpool.c
@@ -89,6 +89,9 @@ FAR struct iob_s *can_iob_timedalloc(bool throttled, unsigned 
int timeout,
   unsigned int count2 = 0;
   int          blresult1 = -ENOENT;
   int          blresult2 = -ENOENT;
+  FAR void    *buf;
+
+  UNUSED(throttled);
 
   if (sconn != NULL)
     {
@@ -100,9 +103,7 @@ FAR struct iob_s *can_iob_timedalloc(bool throttled, 
unsigned int timeout,
       blresult2 = nxrmutex_breaklock(&dev->d_lock, &count2);
     }
 
-  FAR void *buf = mempool_zallocate_throttled(&g_can_buffer, timeout,
-                                              throttled);
-
+  buf = NET_BUFPOOL_TIMEDALLOC(g_can_buffer, timeout);
   if (buf != NULL)
     {
       buf = iob_init_with_data(buf, CAN_BUFFER_SIZE, can_buf_free);
@@ -137,7 +138,7 @@ FAR struct iob_s *can_iob_clone(FAR struct net_driver_s 
*dev)
 {
   FAR struct iob_s *iob;
 
-  iob = can_iob_timedalloc(throttled, 0, NULL, NULL);
+  iob = can_iob_timedalloc(false, 0, NULL, NULL);
   if (iob == NULL)
     {
       return NULL;

Reply via email to