Skip to contentSkip to conversation

fixing errors handling during pci_driver resume stage [misc]

PATCH In review Dmitriy Monakhov 1 participant 1 message Jan 9, 2007

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 4/5 fixing errors handling during pci_driver resume stage [misc]

pci drivers have to return correct error code during resume stage in case of errors.

-----

drivers/ide/pci/sc1200.c +7 -1
index ff80937..a426905 100644
@@ -394,10 +394,16 @@ static int sc1200_suspend (struct pci_de
 static int sc1200_resume (struct pci_dev *dev)
 {
 	ide_hwif_t	*hwif = NULL;
+	int err;
 
 	pci_set_power_state(dev, PCI_D0);	// bring chip back from sleep state
 	dev->current_state = PM_EVENT_ON;
-	pci_enable_device(dev);
+	err = pci_enable_device(dev);
+	if (err) {
+		dev_err(&dev->dev, "Cannot enable PCI device, aborting.\n");
+		return err;
+	}
+
 	//
 	// loop over all interfaces that are part of this pci device:
 	//
drivers/misc/tifm_7xx1.c +7 -2
index 2ab7add..d659ad9 100644
@@ -274,10 +274,15 @@ static int tifm_7xx1_suspend(struct pci_
 static int tifm_7xx1_resume(struct pci_dev *dev)
 {
 	struct tifm_adapter *fm = pci_get_drvdata(dev);
-	unsigned long flags;
+	unsigned long flags, err;
 
 	pci_restore_state(dev);
-        pci_enable_device(dev);
+	err = pci_enable_device(dev);
+	if (err) {
+		dev_err(&dev->dev, "Cannot enable PCI device, aborting.\n");
+		return err;
+	}
+
         pci_set_power_state(dev, PCI_D0);
         pci_set_master(dev);
 
drivers/mmc/sdhci.c +5 -1
index c2d13d7..736f74c 100644
@@ -1109,7 +1109,11 @@ static int sdhci_resume (struct pci_dev
 
 	pci_set_power_state(pdev, PCI_D0);
 	pci_restore_state(pdev);
-	pci_enable_device(pdev);
+	ret = pci_enable_device(pdev);
+	if (ret) {
+		dev_err(&pdev->dev, "Cannot enable PCI device, aborting.\n");
+		return ret;
+	}
 
 	for (i = 0;i < chip->num_slots;i++) {
 		if (!chip->hosts[i])
drivers/parisc/superio.c +3 -1
index 1fd97f7..4428ffa 100644
@@ -199,7 +199,8 @@ superio_init(struct pci_dev *pcidev)
 	pci_write_config_word (pdev, PCI_COMMAND, word);
 
 	pci_set_master (pdev);
-	pci_enable_device(pdev);
+	if (pci_enable_device(pdev))
+		return;
 
 	/*
 	 * Next project is programming the onboard interrupt controllers.
@@ -275,6 +276,7 @@ superio_init(struct pci_dev *pcidev)
 			SUPERIO, (void *)sio)) {
 
 		printk(KERN_ERR PFX "could not get irq\n");
+		pci_disable_device(pdev);
 		BUG();
 		return;
 	}