From: Maciej Sosnowski Date: Wed, 23 May 2012 15:27:07 +0000 (+0200) Subject: dca: check against empty dca_domains list before unregister provider X-Git-Tag: next-20130218~69^2~1 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0d312847e3429bbc349d53e27d6f0b2efbde3dab;p=karo-tx-linux.git dca: check against empty dca_domains list before unregister provider When providers get blocked unregister_dca_providers() is called ending up with dca_providers and dca_domain lists emptied. Dca should be prevented from trying to unregister any provider if dca_domain list is found empty. Cc: Reported-by: Jiang Liu Tested-by: Gaohuai Han Signed-off-by: Maciej Sosnowski Signed-off-by: Dan Williams --- diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c index bc6f5faa1e9e..819dfda88236 100644 --- a/drivers/dca/dca-core.c +++ b/drivers/dca/dca-core.c @@ -420,6 +420,11 @@ void unregister_dca_provider(struct dca_provider *dca, struct device *dev) raw_spin_lock_irqsave(&dca_lock, flags); + if (list_empty(&dca_domains)) { + raw_spin_unlock_irqrestore(&dca_lock, flags); + return; + } + list_del(&dca->node); pci_rc = dca_pci_rc_from_dev(dev);