Hi,
I have found a bug in your code and architecture of the Adin2111 driver available from here: https://www.analog.com/en/products/adin2111.html#software-resources -> ADIN2111 Non Operating System Driver.
The library is constructed in such way that hal parameter hDevice->adinDevice is assumed to be the adin2111_DeviceHandle_t type. And in current code it actually is this type as it does not support passing custom parameter and this struct is passed as hal parameter to the macInit. But when one wants to change it and pass there something different (as the API supposed to be and thankfully mostly is) then one line in adi_spi_generic.c is writing over this pointer and casues undefined behavior as it may rewrite user memory without its knowledge.
I came into this problem when I was enabling ADIN2111 device in a C++ project where I needed to pass my custom parameter to the library as adinDevice.
Please consider to fix at least the line below (and possibly slighly adapt adin2111_Init function so that it fully supports user-defined parameters across HAL functions and callbacks.
Problem n adi_spi_generic.c, line 245:
hDevice->cbFunc[ADI_MAC_EVT_DYN_TBL_UPDATE](hDevice->adinDevice, Event, hDevice->pRxQueue->pEntries[tail].pBufDesc);
hDevice->cbFunc[ADI_MAC_EVT_DYN_TBL_UPDATE](hDevice->cbParam[ADI_MAC_EVT_DYN_TBL_UPDATE], Event, hDevice->pRxQueue->pEntries[tail].pBufDesc);
Edit Notes
Added ADIN2111 to title[edited by: matirekrut at 2:22 PM (GMT -5) on 6 Mar 2026]

