i40e: Remove timer and task only if created
authorShannon Nelson <shannon.nelson@intel.com>
Thu, 10 Mar 2016 22:59:45 +0000 (14:59 -0800)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 5 Apr 2016 19:26:09 +0000 (12:26 -0700)
In some error scenarios, we may find ourselves trying to remove a
non-existent timer or worktask.  This causes the kernel some bit
of consternation, so don't do it.

Signed-off-by: Shannon Nelson <shannon.nelson@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/i40e/i40e_main.c

index 56d4416c9a11c61f813fa5661af8610f4d99b871..e615f66f576f1f47f9a4583ad45b9d854054e4b6 100644 (file)
@@ -11306,8 +11306,10 @@ static void i40e_remove(struct pci_dev *pdev)
        /* no more scheduling of any task */
        set_bit(__I40E_SUSPENDED, &pf->state);
        set_bit(__I40E_DOWN, &pf->state);
-       del_timer_sync(&pf->service_timer);
-       cancel_work_sync(&pf->service_task);
+       if (pf->service_timer.data)
+               del_timer_sync(&pf->service_timer);
+       if (pf->service_task.func)
+               cancel_work_sync(&pf->service_task);
 
        if (pf->flags & I40E_FLAG_SRIOV_ENABLED) {
                i40e_free_vfs(pf);