From 65d8429d291c0bbad57c2ebe53a5d1f12c7327d1 Mon Sep 17 00:00:00 2001 From: Jukka Rissanen Date: Fri, 6 Mar 2020 15:19:50 +0200 Subject: [PATCH] net: pkt: Print caller and line when allocation fails It is useful to know who called the net_pkt allocator when we run out of buffers. Signed-off-by: Jukka Rissanen --- subsys/net/ip/net_pkt.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/net/ip/net_pkt.c b/subsys/net/ip/net_pkt.c index 8345649f96b..9cf619f142e 100644 --- a/subsys/net/ip/net_pkt.c +++ b/subsys/net/ip/net_pkt.c @@ -1150,7 +1150,11 @@ int net_pkt_alloc_buffer(struct net_pkt *pkt, #endif if (!buf) { +#if NET_LOG_LEVEL >= LOG_LEVEL_DBG + NET_ERR("Data buffer allocation failed (%s:%d)", caller, line); +#else NET_ERR("Data buffer allocation failed."); +#endif return -ENOMEM; }