So warn on that case instead of trying to free them, which would be fatal
in case we actuall had active ones.

Signed-off-by: Christoph Hellwig <h...@lst.de>
---
 drivers/scsi/wd719x.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/wd719x.c b/drivers/scsi/wd719x.c
index 974bfb3f30f4..7b05bbcfb186 100644
--- a/drivers/scsi/wd719x.c
+++ b/drivers/scsi/wd719x.c
@@ -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);
-- 
2.19.1

Reply via email to