drivers: lora: sx1276: handle NULL callback in irqHandlers
Part of sx1276 driver which is in loramac-node module passes to Zephyr irqHandlers with callbacks. Some of those callbacks can be NULL and this is true now (with the current version of loramac-node) for DIO5. If we define all 0-5 DIOs in dts, then this results in interrupts which are unwanted. As we do not check that loramac-node callback is NULL, then we crash trying to call it. Check every handler during initialization and just skip initialization of GPIO if it is NULL. This also prevents crashes, because there is no way GPIO interrupt to be triggered in runtime for this DIO. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
This commit is contained in:
parent
45f126f871
commit
8cfef933d7
1 changed files with 4 additions and 0 deletions
|
@ -177,6 +177,10 @@ void SX1276IoIrqInit(DioIrqHandler **irqHandlers)
|
|||
|
||||
/* Setup DIO gpios */
|
||||
for (i = 0; i < SX1276_MAX_DIO; i++) {
|
||||
if (!irqHandlers[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
dev_data.dio_dev[i] = device_get_binding(sx1276_dios[i].port);
|
||||
if (dev_data.dio_dev[i] == NULL) {
|
||||
LOG_ERR("Cannot get pointer to %s device",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue