[PATCH] ahci: fix NULL pointer dereference detected by Coverity
authorTejun Heo <htejun@gmail.com>
Sat, 11 Mar 2006 03:47:54 +0000 (12:47 +0900)
committerJeff Garzik <jeff@garzik.org>
Sun, 12 Mar 2006 00:06:02 +0000 (19:06 -0500)
Fix NULL pointer dereference detected by the Coverity checker.  Kill
dev -> pdev -> dev conversion while at it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/scsi/ahci.c

index a800fb51168b0bb64b0540fdb133545ac881e4cf..559ff7aae3f113e4f61e551050c289b73f7fa6d6 100644 (file)
@@ -742,23 +742,17 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
                        struct ata_queued_cmd *qc;
                        qc = ata_qc_from_tag(ap, ap->active_tag);
                        if (!ahci_host_intr(ap, qc))
-                               if (ata_ratelimit()) {
-                                       struct pci_dev *pdev =
-                                               to_pci_dev(ap->host_set->dev);
-                                       dev_printk(KERN_WARNING, &pdev->dev,
+                               if (ata_ratelimit())
+                                       dev_printk(KERN_WARNING, host_set->dev,
                                          "unhandled interrupt on port %u\n",
                                          i);
-                               }
 
                        VPRINTK("port %u\n", i);
                } else {
                        VPRINTK("port %u (no irq)\n", i);
-                       if (ata_ratelimit()) {
-                               struct pci_dev *pdev =
-                                       to_pci_dev(ap->host_set->dev);
-                               dev_printk(KERN_WARNING, &pdev->dev,
+                       if (ata_ratelimit())
+                               dev_printk(KERN_WARNING, host_set->dev,
                                        "interrupt on disabled port %u\n", i);
-                       }
                }
 
                irq_ack |= (1 << i);