aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2006-12-06 23:36:12 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-07 11:39:32 -0500
commit23a1b2a78705caa2ecaccf8422a1e22eaca59574 (patch)
tree295f176624b71ee9507198909ac2fa33f7afeac8 /drivers/ide/pci
parent87b4126f10cce2d49687df227f6228fa5a9ac6c6 (diff)
[PATCH] via82cxxx: handle error condition properly
Jeff noted that the via driver returned an error to an unsigned int in a a case where errors are not permitted. Move the check down earlier so we can handle it properly. Not as pretty but it works this way and avoids hacking up ugly stuff in the legacy ide core. Signed-off-by: Alan Cox <alan@redhat.com> Cc: Jeff Garzik <jeff@garzik.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/ide/pci')
-rw-r--r--drivers/ide/pci/via82cxxx.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c
index eb7ab112c050..61f1a9665a7f 100644
--- a/drivers/ide/pci/via82cxxx.c
+++ b/drivers/ide/pci/via82cxxx.c
@@ -282,11 +282,11 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const
282 * Find the ISA bridge to see how good the IDE is. 282 * Find the ISA bridge to see how good the IDE is.
283 */ 283 */
284 via_config = via_config_find(&isa); 284 via_config = via_config_find(&isa);
285 if (!via_config->id) { 285
286 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); 286 /* We checked this earlier so if it fails here deeep badness
287 pci_dev_put(isa); 287 is involved */
288 return -ENODEV; 288
289 } 289 BUG_ON(!via_config->id);
290 290
291 /* 291 /*
292 * Setup or disable Clk66 if appropriate 292 * Setup or disable Clk66 if appropriate
@@ -494,6 +494,17 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
494 494
495static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) 495static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
496{ 496{
497 struct pci_dev *isa = NULL;
498 struct via_isa_bridge *via_config;
499 /*
500 * Find the ISA bridge and check we know what it is.
501 */
502 via_config = via_config_find(&isa);
503 pci_dev_put(isa);
504 if (!via_config->id) {
505 printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n");
506 return -ENODEV;
507 }
497 return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); 508 return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]);
498} 509}
499 510