Commit c9abde12 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Jeff Garzik
Browse files

libata: remove superfluous NULL pointer checks

host->ports[] always contain pointers to valid port structures since
a "dummy port" structure is used in case if there is no physical port.

This patch takes care of two entries from Dan's list:

drivers/ata/sata_sil.c +535 sil_interrupt(13) warning: variable derefenced before check 'ap'
drivers/ata/sata_mv.c +2517 mv_unexpected_intr(6) warning: variable derefenced before check 'ap'

and of another needless NULL pointer check in pata_octeon_cf.c.
Reported-by: default avatarDan Carpenter <>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <>
Signed-off-by: default avatarJeff Garzik <>
parent 705d2014
......@@ -653,7 +653,8 @@ static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
ap = host->ports[i];
ocd = ap->dev->platform_data;
if (!ap || (ap->flags & ATA_FLAG_DISABLED))
if (ap->flags & ATA_FLAG_DISABLED)
ocd = ap->dev->platform_data;
......@@ -2514,7 +2514,7 @@ static void mv_unexpected_intr(struct ata_port *ap, int edma_was_enabled)
char *when = "idle";
if (!ap || (ap->flags & ATA_FLAG_DISABLED)) {
if (ap->flags & ATA_FLAG_DISABLED) {
when = "disabled";
} else if (edma_was_enabled) {
when = "EDMA enabled";
......@@ -532,7 +532,7 @@ static irqreturn_t sil_interrupt(int irq, void *dev_instance)
struct ata_port *ap = host->ports[i];
u32 bmdma2 = readl(mmio_base + sil_port[ap->port_no].bmdma2);
if (unlikely(!ap || ap->flags & ATA_FLAG_DISABLED))
if (unlikely(ap->flags & ATA_FLAG_DISABLED))
/* turn off SATA_IRQ if not supported */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment