pata_qdi: Fix initialisation

The QDI init code contains some bugs which mean it only works if you have
a test setup that causes both a successful and failed probe. Fix this

Found by Philip Guo

(Who found it working on code analysis tools not running VLB IDE
controllers)

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>

authored by Alan Cox and committed by Jeff Garzik cc7c15ec fb9f8905

+8 -4
+8 -4
drivers/ata/pata_qdi.c
··· 363 363 release_region(port, 2); 364 364 continue; 365 365 } 366 - ct += qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); 366 + if (qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04) == 0) 367 + ct++; 367 368 } 368 369 if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) { 369 370 /* QD6580: dual channel */ ··· 376 375 res = inb(port + 3); 377 376 if (res & 1) { 378 377 /* Single channel mode */ 379 - ct += qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); 378 + if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04)) 379 + ct++; 380 380 } else { 381 381 /* Dual channel mode */ 382 - ct += qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04); 383 - ct += qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04); 382 + if (qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04) == 0) 383 + ct++; 384 + if (qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04) == 0) 385 + ct++; 384 386 } 385 387 } 386 388 }