All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@sous-sol.org>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Chris Wright <chrisw@sous-sol.org>, kvm-devel@lists.sourceforge.net
Subject: [patch 3/2] hotadd: lsi_scsi_init can fail
Date: Mon, 21 Apr 2008 22:14:57 -0700	[thread overview]
Message-ID: <20080422051457.GC3861@localhost.localdomain> (raw)
In-Reply-To: <20080422030229.GA10614@dmt>

During hotadd of SCSI devices lsi_scsi_init() handles failed
pci_device_register(), but qemu_system_hot_add_storage() will try and
attach a drive any way.  Handle this error case rather the generating
SEGV.

Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
 qemu/hw/device-hotplug.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/qemu/hw/device-hotplug.c
+++ b/qemu/hw/device-hotplug.c
@@ -125,7 +125,7 @@ static PCIDevice *qemu_system_hot_add_st
     switch (type) {
     case IF_SCSI:
         opaque = lsi_scsi_init (pci_bus, -1);
-        if (drive_idx >= 0)
+        if (opaque && drive_idx >= 0)
             lsi_scsi_attach (opaque, drives_table[drive_idx].bdrv,
                              drives_table[drive_idx].unit);
         break;

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

  parent reply	other threads:[~2008-04-22  5:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-21 23:02 [patch 0/2] pci_register_device can fail Chris Wright
2008-04-21 23:02 ` [patch 1/2] [PATCH] pci nic: " Chris Wright
2008-04-21 23:02 ` [patch 2/2] [PATCH] virtio-blk: virtio_pci_init " Chris Wright
2008-04-22  3:02   ` Marcelo Tosatti
2008-04-22  5:07     ` Chris Wright
2008-04-22  5:14     ` Chris Wright [this message]
2008-04-22  6:02       ` [patch 3/2] hotadd: lsi_scsi_init " Avi Kivity
2008-04-22 11:21 ` [patch 0/2] pci_register_device " Avi Kivity

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=20080422051457.GC3861@localhost.localdomain \
    --to=chrisw@sous-sol.org \
    --cc=kvm-devel@lists.sourceforge.net \
    --cc=mtosatti@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.