]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scsi: wd719x: there should be no active SCBs on removal
authorChristoph Hellwig <hch@lst.de>
Fri, 9 Nov 2018 15:54:04 +0000 (16:54 +0100)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 15 Nov 2018 19:27:08 +0000 (14:27 -0500)
Warn on that case instead of trying to free them which would be fatal in
case we actually had active ones.

[mkp: typos]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/wd719x.c

index 974bfb3f30f4273ee96a89f7faffe712538f1b17..7b05bbcfb18618543d466c0ae8fc2036826a300c 100644 (file)
@@ -162,10 +162,9 @@ static void wd719x_destroy(struct wd719x *wd)
        /* disable RISC */
        wd719x_writeb(wd, WD719X_PCI_MODE_SELECT, 0);
 
+       WARN_ON_ONCE(!list_empty(&wd->active_scbs));
+
        /* free all SCBs */
-       list_for_each_entry(scb, &wd->active_scbs, list)
-               pci_free_consistent(wd->pdev, sizeof(struct wd719x_scb), scb,
-                                   scb->phys);
        list_for_each_entry(scb, &wd->free_scbs, list)
                pci_free_consistent(wd->pdev, sizeof(struct wd719x_scb), scb,
                                    scb->phys);