Skip to content

Commit

Permalink
cmd640: fix kernel oops in test_irq() method
Browse files Browse the repository at this point in the history
When implementing the test_iqr() method, I forgot that this driver is not an
ordinary PCI driver and also needs to support VLB variant of the chip. Moreover,
'hwif->dev' should be NULL, potentially causing oops in pci_read_config_byte().

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sergei Shtylyov authored and David S. Miller committed May 11, 2010
1 parent f693be4 commit a9ddabc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/ide/cmd640.c
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,10 @@ static void __init cmd640_init_dev(ide_drive_t *drive)

static int cmd640_test_irq(ide_hwif_t *hwif)
{
struct pci_dev *dev = to_pci_dev(hwif->dev);
int irq_reg = hwif->channel ? ARTTIM23 : CFR;
u8 irq_stat, irq_mask = hwif->channel ? ARTTIM23_IDE23INTR :
u8 irq_mask = hwif->channel ? ARTTIM23_IDE23INTR :
CFR_IDE01INTR;

pci_read_config_byte(dev, irq_reg, &irq_stat);
u8 irq_stat = get_cmd640_reg(irq_reg);

return (irq_stat & irq_mask) ? 1 : 0;
}
Expand Down

0 comments on commit a9ddabc

Please sign in to comment.