diff mbox

lsi53c895a: avoid calling a NULL function

Message ID 1283434657-12843-1-git-send-email-bernhard.kohl@nsn.com
State New
Headers show

Commit Message

Bernhard Kohl Sept. 2, 2010, 1:37 p.m. UTC
In scsi-generic the reset() function is not available.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
---
 hw/lsi53c895a.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Comments

Kevin Wolf Sept. 2, 2010, 2:45 p.m. UTC | #1
Am 02.09.2010 15:37, schrieb Bernhard Kohl:
> In scsi-generic the reset() function is not available.
> 
> Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
> ---
>  hw/lsi53c895a.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
> index 5eaf69e..01ff028 100644
> --- a/hw/lsi53c895a.c
> +++ b/hw/lsi53c895a.c
> @@ -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
Bernhard Kohl Sept. 6, 2010, 9:30 a.m. UTC | #2
Am 02.09.2010 16:45, schrieb ext Kevin Wolf:
> 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
diff mbox

Patch

diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 5eaf69e..01ff028 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -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;