debug_put_get: don't crash on null pointers
MFC after: 7 days
This commit is contained in:
parent
b41818a28a
commit
92e8b4a630
@ -1628,8 +1628,8 @@ void __netmap_adapter_get(struct netmap_adapter *na);
|
||||
#define netmap_adapter_get(na) \
|
||||
do { \
|
||||
struct netmap_adapter *__na = na; \
|
||||
nm_prinf("getting %p:%s (%d)", __na, (__na)->name, (__na)->na_refcount); \
|
||||
__netmap_adapter_get(__na); \
|
||||
nm_prinf("getting %p:%s -> %d", __na, (__na)->name, (__na)->na_refcount); \
|
||||
} while (0)
|
||||
|
||||
int __netmap_adapter_put(struct netmap_adapter *na);
|
||||
@ -1637,8 +1637,11 @@ int __netmap_adapter_put(struct netmap_adapter *na);
|
||||
#define netmap_adapter_put(na) \
|
||||
({ \
|
||||
struct netmap_adapter *__na = na; \
|
||||
nm_prinf("putting %p:%s (%d)", __na, (__na)->name, (__na)->na_refcount); \
|
||||
__netmap_adapter_put(__na); \
|
||||
if (__na == NULL) \
|
||||
nm_prinf("putting NULL"); \
|
||||
else \
|
||||
nm_prinf("putting %p:%s -> %d", __na, (__na)->name, (__na)->na_refcount - 1); \
|
||||
__netmap_adapter_put(__na); \
|
||||
})
|
||||
|
||||
#else /* !NM_DEBUG_PUTGET */
|
||||
|
Loading…
Reference in New Issue
Block a user