Patchwork lsi53c895a: avoid calling a NULL function

login
register
mail settings
Submitter Bernhard Kohl
Date Sept. 2, 2010, 1:37 p.m.
Message ID <1283434657-12843-1-git-send-email-bernhard.kohl@nsn.com>
Download mbox | patch
Permalink /patch/63490/
State New
Headers show

Comments

Bernhard Kohl - Sept. 2, 2010, 1:37 p.m.
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(-)
Kevin Wolf - Sept. 2, 2010, 2:45 p.m.
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.
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

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;