summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-07-02 17:03:55 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-07-26 17:44:08 +0200
commit2f0772c5b4818d4b2078be9dace0036d1030faee (patch)
tree2f6af49673ddcc80bf27e96fafa12b9d10a5f606 /hw
parente2b06058f7a0812729b95bcd4600238165323220 (diff)
downloadhqemu-2f0772c5b4818d4b2078be9dace0036d1030faee.zip
hqemu-2f0772c5b4818d4b2078be9dace0036d1030faee.tar.gz
lsi: use qdev_reset_all
By first resetting the devices, lsi_soft_reset will find the queue already cleared so there is no need to do that forcibly (which may also leak SCSIRequests, and/or worse due to dangling references to the lsi_request in the hba_private field). Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/lsi53c895a.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 2fe141d..f04cc68 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -282,8 +282,6 @@ static inline int lsi_irq_on_rsl(LSIState *s)
static void lsi_soft_reset(LSIState *s)
{
- lsi_request *p;
-
DPRINTF("Reset\n");
s->carry = 0;
@@ -350,15 +348,8 @@ static void lsi_soft_reset(LSIState *s)
s->sbc = 0;
s->csbc = 0;
s->sbr = 0;
- while (!QTAILQ_EMPTY(&s->queue)) {
- p = QTAILQ_FIRST(&s->queue);
- QTAILQ_REMOVE(&s->queue, p, next);
- g_free(p);
- }
- if (s->current) {
- g_free(s->current);
- s->current = NULL;
- }
+ assert(QTAILQ_EMPTY(&s->queue));
+ assert(!s->current);
}
static int lsi_dma_40bit(LSIState *s)
@@ -1738,7 +1729,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
lsi_execute_script(s);
}
if (val & LSI_ISTAT0_SRST) {
- lsi_soft_reset(s);
+ qdev_reset_all(&s->dev.qdev);
}
break;
case 0x16: /* MBOX0 */
OpenPOWER on IntegriCloud