public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH 5/6]: hotplug/ia64: SN Hotplug Driver - SN Hotplug Driver
Date: Tue, 17 May 2005 12:47:08 +0000	[thread overview]
Message-ID: <4289E7CC.4080900@sgi.com> (raw)
In-Reply-To: <42835EAB.7010905@sgi.com>

Greg KH wrote:
>>+
>>+	while ((pci_bus = pci_find_next_bus(pci_bus))) {
>>+		if (!pci_bus->sysdata)
>>+			continue;
>>+
>>+		rc = sn_pci_bus_valid(pci_bus);
>>+		if (rc != 1) {
>>+			dev_dbg(pci_bus->self, "not a valid hotplug bus\n");
>>+			continue;
>>+		}
>>+		dev_dbg(pci_bus->self, "valid hotplug bus\n");
>>+
>>+		rc = sn_hotplug_slot_register(pci_bus);
>>+		if (!rc)
>>+			registered = 1;
>>+		else {
>>+			registered = 0;
>>+			break;
>>+		}
>>+	}
> 
> 
> How do you recover if you fail the second (or third, or fourth) hotplug bus register?  It
> looks like the code will die a horrible death...
> 

Greg,

The return of sn_hotplug_slot_register is an indication of whether or not all 
slots had been properly registered.

The error handling is in sn_hotplug_slot_register.  If I fail a second, or 
third, or an nth hotplug register, the clean up is done in the following code 
(from sn_hotplug_slot_register).

+               rc = pci_hp_register(bss_hotplug_slot);
+               if (rc)
+                       goto register_err;
+       }
+       dev_dbg(pci_bus->self, "Registered bus with hotplug\n");
+       return rc;
+
+register_err:
+       dev_dbg(pci_bus->self, "bus failed to register with err = %d\n",
+               rc);
+
+alloc_err:
+       if (rc = -ENOMEM)
+               dev_dbg(pci_bus->self, "Memory allocation error\n");
+
+       /* destroy THIS element */
+       if (bss_hotplug_slot)
+               sn_release_slot(bss_hotplug_slot);
+
+       /* destroy anything else on the list */
+       while ((bss_hotplug_slot = sn_hp_destroy()))
+               pci_hp_deregister(bss_hotplug_slot);
+
+       return rc;
+}

P.

      parent reply	other threads:[~2005-05-17 12:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-12 13:48 [PATCH 5/6]: hotplug/ia64: SN Hotplug Driver - SN Hotplug Driver Prarit Bhargava
2005-05-13  0:46 ` [PATCH 5/6]: hotplug/ia64: SN Hotplug Driver - SN Hotplug Driver code Prarit Bhargava
2005-05-13 16:44 ` Greg KH
2005-05-17 12:47 ` Prarit Bhargava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4289E7CC.4080900@sgi.com \
    --to=prarit@sgi.com \
    --cc=linux-ia64@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox