Skip to content

Commit f777030

Browse files
Matthew Mulloy Steinbornnashif
authored andcommitted
drivers: i3c: i3c_cdns Fix null pointer issue in i3c cadence driver.
Fixing a bug where during the bus_init routine, when a slave is initialized, the target hardware can get an interrupt, and this can occur before the target_config structure is assigned; the generic IRQ handler attempts to use this structure to grab callback function pointers, but with no target config it attempts to access the structure member from a null pointer. Fix works by adding ternary operation during IRQ that first checks if target_config is null or not. Signed-off-by: Matthew Mulloy Steinborn <[email protected]>
1 parent 02c8659 commit f777030

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/i3c/i3c_cdns.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,7 +2450,8 @@ static void cdns_i3c_irq_handler(const struct device *dev)
24502450
} else {
24512451
uint32_t int_sl = sys_read32(config->base + SLV_ISR);
24522452
struct cdns_i3c_data *data = dev->data;
2453-
const struct i3c_target_callbacks *target_cb = data->target_config->callbacks;
2453+
const struct i3c_target_callbacks *target_cb =
2454+
data->target_config ? data->target_config->callbacks : NULL;
24542455
/* Clear interrupts */
24552456
sys_write32(int_sl, config->base + SLV_ICR);
24562457

0 commit comments

Comments
 (0)