All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppc440: Avoid reporting error when reading non-existent RAM slot
@ 2019-01-09 22:37 BALATON Zoltan
  2019-01-11  0:21 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: BALATON Zoltan @ 2019-01-09 22:37 UTC (permalink / raw)
  To: qemu-devel, qemu-ppc; +Cc: David Gibson

When reading base register of RAM slot with no RAM we should not try
to calculate register value because that will result printing an error
due to invalid RAM size. Just return 0 without the error in this case.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
 hw/ppc/ppc440_uc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c
index c489368905..9130eb314c 100644
--- a/hw/ppc/ppc440_uc.c
+++ b/hw/ppc/ppc440_uc.c
@@ -613,8 +613,10 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn)
     case SDRAM_R1BAS:
     case SDRAM_R2BAS:
     case SDRAM_R3BAS:
-        ret = sdram_bcr(sdram->ram_bases[dcrn - SDRAM_R0BAS],
-                        sdram->ram_sizes[dcrn - SDRAM_R0BAS]);
+        if (sdram->ram_sizes[dcrn - SDRAM_R0BAS]) {
+            ret = sdram_bcr(sdram->ram_bases[dcrn - SDRAM_R0BAS],
+                            sdram->ram_sizes[dcrn - SDRAM_R0BAS]);
+        }
         break;
     case SDRAM_CONF1HB:
     case SDRAM_CONF1LL:
-- 
2.13.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] ppc440: Avoid reporting error when reading non-existent RAM slot
  2019-01-09 22:37 [Qemu-devel] [PATCH] ppc440: Avoid reporting error when reading non-existent RAM slot BALATON Zoltan
@ 2019-01-11  0:21 ` David Gibson
  0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2019-01-11  0:21 UTC (permalink / raw)
  To: BALATON Zoltan; +Cc: qemu-devel, qemu-ppc

[-- Attachment #1: Type: text/plain, Size: 1385 bytes --]

On Wed, Jan 09, 2019 at 11:37:33PM +0100, BALATON Zoltan wrote:
> When reading base register of RAM slot with no RAM we should not try
> to calculate register value because that will result printing an error
> due to invalid RAM size. Just return 0 without the error in this case.
> 
> Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>

Applied, thanks.

> ---
>  hw/ppc/ppc440_uc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ppc/ppc440_uc.c b/hw/ppc/ppc440_uc.c
> index c489368905..9130eb314c 100644
> --- a/hw/ppc/ppc440_uc.c
> +++ b/hw/ppc/ppc440_uc.c
> @@ -613,8 +613,10 @@ static uint32_t dcr_read_sdram(void *opaque, int dcrn)
>      case SDRAM_R1BAS:
>      case SDRAM_R2BAS:
>      case SDRAM_R3BAS:
> -        ret = sdram_bcr(sdram->ram_bases[dcrn - SDRAM_R0BAS],
> -                        sdram->ram_sizes[dcrn - SDRAM_R0BAS]);
> +        if (sdram->ram_sizes[dcrn - SDRAM_R0BAS]) {
> +            ret = sdram_bcr(sdram->ram_bases[dcrn - SDRAM_R0BAS],
> +                            sdram->ram_sizes[dcrn - SDRAM_R0BAS]);
> +        }
>          break;
>      case SDRAM_CONF1HB:
>      case SDRAM_CONF1LL:

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-01-11  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 22:37 [Qemu-devel] [PATCH] ppc440: Avoid reporting error when reading non-existent RAM slot BALATON Zoltan
2019-01-11  0:21 ` David Gibson

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.