Skip to contentSkip to conversation

lsi53c895a: avoid calling a NULL function

PATCH In review Bernhard Kohl 2 participants 3 messages Sep 2, 2010 – Sep 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lsi53c895a: avoid calling a NULL function

In scsi-generic the reset() function is not available.

---
 hw/lsi53c895a.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
hw/lsi53c895a.c +3 -1
index 5eaf69e..01ff028 100644
@@ -1597,7 +1597,9 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
                 for (id = 0; id < s->bus.ndev; id++) {
                     if (s->bus.devs[id]) {
                         dev = &s->bus.devs[id]->qdev;
-                        dev->info->reset(dev);
+                        if (dev->info->reset) {
+                            dev->info->reset(dev);
+                        }
                     }
                 }
                 s->sstat0 |= LSI_SSTAT0_RST;
Signature · 1 line
1.7.2.2
#1 lore raw

Am 02.09.2010 15:37, schrieb Bernhard Kohl:

Quoted 12 lines

In scsi-generic the reset() function is not available.

---
 hw/lsi53c895a.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
hw/lsi53c895a.c +0 -0
index 5eaf69e..01ff028 100644

hw/lsi53c895a.c static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val) · line 1605

Quoted 10 lines
hw/lsi53c895a.c +3 -1
@@ -1597,7 +1597,9 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
                 for (id = 0; id < s->bus.ndev; id++) {
                     if (s->bus.devs[id]) {
                         dev = &s->bus.devs[id]->qdev;
-                        dev->info->reset(dev);
+                        if (dev->info->reset) {
+                            dev->info->reset(dev);
+                        }
                     }
                 }
                 s->sstat0 |= LSI_SSTAT0_RST;

I suspect the real fix is to add a reset handler to scsi-generic. It should probably remove the requests like it's currently done in scsi_destroy. The same change was made for scsi-disk in e9447f35.

Kevin

#2 lore raw

Am 02.09.2010 16:45, schrieb ext Kevin Wolf:

Quoted 4 lines

I suspect the real fix is to add a reset handler to scsi-generic. It should probably remove the requests like it's currently done in scsi_destroy. The same change was made for scsi-disk in e9447f35.

Yes, I agree. Let's skip this patch. I'll send another one.

Bernhard