dca: missing unlock in unregister_dca_providers()
PATCH 1/1 dca: missing unlock in unregister_dca_providers()
We return here with the lock held and IRQs disabled by mistake.
drivers/dca/dca-core.c +3 -1
@@ -110,8 +110,10 @@ static void unregister_dca_providers(void)/* at this point only one domain in the list is expected */ domain = list_first_entry(&dca_domains, struct dca_domain, node); -if (!domain) +if (!domain) { +spin_unlock_irqrestore (&dca_lock, flags);return ; + }list_for_each_entry_safe (dca, _dca, &domain->dca_providers, node) {list_del (&dca->node);
Quoted 10 lines · On Wed, 17 Nov 2010 08:10:32 +0300 Dan Carpenter <[email protected]> wrote:
We return here with the lock held and IRQs disabled by mistake.
Signed-off-by Dan Carpenter <[email protected]>drivers/dca/dca-core.c +0
-0@@ -110,8 +110,10 @@ static void unregister_dca_providers(void)
drivers/dca/dca-core.c static void unregister_dca_providers(void) · line 119
Quoted 10 lines
drivers/dca/dca-core.c +3
-1/* at this point only one domain in the list is expected */ domain = list_first_entry(&dca_domains, struct dca_domain, node); -if (!domain) +if (!domain) { +spin_unlock_irqrestore (&dca_lock, flags);return ; + }list_for_each_entry_safe (dca, _dca, &domain->dca_providers, node) {list_del (&dca->node);
I think the code's just bogus, actually.list_first_entry(&dca_domains) can't return NULL.
PATCH v2 1/1 dca: remove unneeded NULL check
The return here doesn't release the locks or re-enable IRQs. But as Andrew Morton points out, domain is never NULL. list_first_entry() essentially never returns NULL and also we already verified that the list is not empty.
drivers/dca/dca-core.c +0 -2
@@ -110,8 +110,6 @@ static void unregister_dca_providers(void)/* at this point only one domain in the list is expected */ domain = list_first_entry(&dca_domains, struct dca_domain, node); -if (!domain) -return ;list_for_each_entry_safe (dca, _dca, &domain->dca_providers, node) {list_del (&dca->node);
RE: [patch v2] dca: remove unneeded NULL check
Quoted 12 lines · Dan Carpenter
The return here doesn't release the locks or re-enable IRQs. But as Andrew Morton points out, domain is never NULL.
list_first_entry()essentially never returns NULL and also we already verified that the list is not empty.Signed-off-by Dan Carpenter <[email protected]>drivers/dca/dca-core.c index renamed from drivers/dca/dca-core.c +0
-0b98c676..c461eda 100644
drivers/dca/dca-core.c static void unregister_dca_providers(void) · line 115
Quoted 8 lines
drivers/dca/dca-core.c +0
-2@@ -110,8 +110,6 @@ static void unregister_dca_providers(void)/* at this point only one domain in the list is expected */ domain = list_first_entry(&dca_domains, struct dca_domain, node); -if (!domain) -return ;list_for_each_entry_safe (dca, _dca, &domain->dca_providers, node) {list_del (&dca->node);