aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac/edac_pci.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2016-02-02 10:59:53 +0100
committerBorislav Petkov <bp@suse.de>2016-02-02 11:04:29 +0100
commit096676061987c613bdacddbae838cb63a815db94 (patch)
tree9a73f90b19376faf2e9c5a55a038000d6ac25594 /drivers/edac/edac_pci.c
parentarm64: Update the APM X-Gene EDAC node with the RB register resource (diff)
downloadlinux-dev-096676061987c613bdacddbae838cb63a815db94.tar.xz
linux-dev-096676061987c613bdacddbae838cb63a815db94.zip
EDAC: Balance workqueue setup and teardown
We use the ->edac_check function pointers to determine whether we need to setup a polling workqueue. However, the destroy path is not balanced and we might try to teardown an unitialized workqueue. Balance init and destroy paths by looking at ->edac_check in both cases. Set op_state to OP_OFFLINE *before* destroying anything. Reported-by: Zhiqiang Hou <Zhiqiang.Hou@freescale.com> Cc: Varun Sethi <Varun.Sethi@freescale.com> Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'drivers/edac/edac_pci.c')
-rw-r--r--drivers/edac/edac_pci.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c
index 99685388d3fb..f0e8c3d01ed5 100644
--- a/drivers/edac/edac_pci.c
+++ b/drivers/edac/edac_pci.c
@@ -241,8 +241,6 @@ static void edac_pci_workq_teardown(struct edac_pci_ctl_info *pci)
{
edac_dbg(0, "\n");
- pci->op_state = OP_OFFLINE;
-
edac_stop_work(&pci->work);
}
@@ -289,7 +287,7 @@ int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx)
goto fail1;
}
- if (pci->edac_check != NULL) {
+ if (pci->edac_check) {
pci->op_state = OP_RUNNING_POLL;
edac_pci_workq_setup(pci, 1000);
@@ -350,8 +348,8 @@ struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev)
mutex_unlock(&edac_pci_ctls_mutex);
- /* stop the workq timer */
- edac_pci_workq_teardown(pci);
+ if (pci->edac_check)
+ edac_pci_workq_teardown(pci);
edac_printk(KERN_INFO, EDAC_PCI,
"Removed device %d for %s %s: DEV %s\n",