pm: add debug_assert for cb register/unregister api
avoid the register/unregister API access wrong memory Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
parent
e11a53bec9
commit
9d396bf89e
@ -57,8 +57,12 @@
|
||||
|
||||
int pm_domain_register(int domain, FAR struct pm_callback_s *cb)
|
||||
{
|
||||
FAR struct pm_domain_s *pdom;
|
||||
irqstate_t flags;
|
||||
struct pm_domain_s *pdom = &g_pmdomains[domain];
|
||||
|
||||
DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
|
||||
|
||||
pdom = &g_pmdomains[domain];
|
||||
flags = spin_lock_irqsave(&pdom->lock);
|
||||
|
||||
/* Add the new entry to the end of the list of registered callbacks */
|
||||
|
@ -56,8 +56,12 @@
|
||||
|
||||
int pm_domain_unregister(int domain, FAR struct pm_callback_s *cb)
|
||||
{
|
||||
FAR struct pm_domain_s *pdom;
|
||||
irqstate_t flags;
|
||||
struct pm_domain_s *pdom = &g_pmdomains[domain];
|
||||
|
||||
DEBUGASSERT(domain >= 0 && domain < CONFIG_PM_NDOMAINS);
|
||||
|
||||
pdom = &g_pmdomains[domain];
|
||||
flags = spin_lock_irqsave(&pdom->lock);
|
||||
|
||||
/* Remove entry from the list of registered callbacks. */
|
||||
|
Loading…
Reference in New Issue
Block a user