mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 01:21:26 +08:00
drivers/foc/foc_dummy.c: update dummy device state only if dev opened
This is fix for seg fault for sim/foc configuration
This commit is contained in:
@@ -687,6 +687,10 @@ void foc_dummy_update(void)
|
||||
|
||||
dev = &g_foc_dev[i];
|
||||
|
||||
/* Update dummy driver state only if device opened */
|
||||
|
||||
if (dev->ocount > 0)
|
||||
{
|
||||
/* Get SIM data */
|
||||
|
||||
sim = FOC_DUMMY_DATA_FROM_DEV_GET(dev);
|
||||
@@ -696,6 +700,7 @@ void foc_dummy_update(void)
|
||||
foc_dummy_notifier_handler(dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user