qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] es1370: fix ADC_FRAMEADR and ADC_FRAMECNT
@ 2018-08-25  7:47 Paolo Bonzini
  2018-10-16 12:30 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2018-08-25  7:47 UTC (permalink / raw)
  To: qemu-devel

They are not consecutive with DAC1_FRAME* and DAC2_FRAME*.

Fixes: 154c1d1f960c5147a3f8ef00907504112f271cd8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/audio/es1370.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
index dd75c9e8f5..4f980a598b 100644
--- a/hw/audio/es1370.c
+++ b/hw/audio/es1370.c
@@ -506,10 +506,13 @@ static void es1370_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
                 d - &s->chan[0], val >> 16, (val & 0xffff));
         break;
 
+    case ES1370_REG_ADC_FRAMEADR:
+        d += 2;
+        goto frameadr;
     case ES1370_REG_DAC1_FRAMEADR:
     case ES1370_REG_DAC2_FRAMEADR:
-    case ES1370_REG_ADC_FRAMEADR:
         d += (addr - ES1370_REG_DAC1_FRAMEADR) >> 3;
+    frameadr:
         d->frame_addr = val;
         ldebug ("chan %td frame address %#x\n", d - &s->chan[0], val);
         break;
@@ -521,10 +524,13 @@ static void es1370_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
         lwarn ("writing to phantom frame address %#x\n", val);
         break;
 
+    case ES1370_REG_ADC_FRAMECNT:
+        d += 2;
+        goto framecnt;
     case ES1370_REG_DAC1_FRAMECNT:
     case ES1370_REG_DAC2_FRAMECNT:
-    case ES1370_REG_ADC_FRAMECNT:
         d += (addr - ES1370_REG_DAC1_FRAMECNT) >> 3;
+    framecnt:
         d->frame_cnt = val;
         d->leftover = 0;
         ldebug ("chan %td frame count %d, buffer size %d\n",
-- 
2.17.1

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

* Re: [Qemu-devel] [PATCH] es1370: fix ADC_FRAMEADR and ADC_FRAMECNT
  2018-08-25  7:47 [Qemu-devel] [PATCH] es1370: fix ADC_FRAMEADR and ADC_FRAMECNT Paolo Bonzini
@ 2018-10-16 12:30 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2018-10-16 12:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers

On 25 August 2018 at 08:47, Paolo Bonzini <pbonzini@redhat.com> wrote:
> They are not consecutive with DAC1_FRAME* and DAC2_FRAME*.
>
> Fixes: 154c1d1f960c5147a3f8ef00907504112f271cd8
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/audio/es1370.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/hw/audio/es1370.c b/hw/audio/es1370.c
> index dd75c9e8f5..4f980a598b 100644
> --- a/hw/audio/es1370.c
> +++ b/hw/audio/es1370.c
> @@ -506,10 +506,13 @@ static void es1370_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
>                  d - &s->chan[0], val >> 16, (val & 0xffff));
>          break;
>
> +    case ES1370_REG_ADC_FRAMEADR:
> +        d += 2;
> +        goto frameadr;
>      case ES1370_REG_DAC1_FRAMEADR:
>      case ES1370_REG_DAC2_FRAMEADR:
> -    case ES1370_REG_ADC_FRAMEADR:
>          d += (addr - ES1370_REG_DAC1_FRAMEADR) >> 3;
> +    frameadr:
>          d->frame_addr = val;
>          ldebug ("chan %td frame address %#x\n", d - &s->chan[0], val);
>          break;
> @@ -521,10 +524,13 @@ static void es1370_write(void *opaque, hwaddr addr, uint64_t val, unsigned size)
>          lwarn ("writing to phantom frame address %#x\n", val);
>          break;
>
> +    case ES1370_REG_ADC_FRAMECNT:
> +        d += 2;
> +        goto framecnt;
>      case ES1370_REG_DAC1_FRAMECNT:
>      case ES1370_REG_DAC2_FRAMECNT:
> -    case ES1370_REG_ADC_FRAMECNT:
>          d += (addr - ES1370_REG_DAC1_FRAMECNT) >> 3;
> +    framecnt:
>          d->frame_cnt = val;
>          d->leftover = 0;
>          ldebug ("chan %td frame count %d, buffer size %d\n",

Hi Paolo; I've just noticed that this patch (now commit cf9270e522067)
fixed the es1370_write() but left the code in es1370_read() unfixed.
Coverity complains in CID 1395185 (though oddly only about the
ADC_FRAMECNT case, not the ADC_FRAMEADR one).

thanks
-- PMM

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

end of thread, other threads:[~2018-10-16 12:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-25  7:47 [Qemu-devel] [PATCH] es1370: fix ADC_FRAMEADR and ADC_FRAMECNT Paolo Bonzini
2018-10-16 12:30 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).