qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Benoît Canet" <benoit.canet@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 3/7] integratorcp: convert control to memory API
Date: Tue, 18 Oct 2011 16:06:43 +0200	[thread overview]
Message-ID: <4E9D87F3.4010901@redhat.com> (raw)
In-Reply-To: <CAFEAcA_-WAWrTbHb9V0E1itC+a=Sy+_5wvQhpRgQSVfpaFVbpQ@mail.gmail.com>

On 10/18/2011 01:44 PM, Peter Maydell wrote:
> 2011/10/17 Benoît Canet <benoit.canet@gmail.com>:
> > -static void icp_control_init(uint32_t base)
> > +static void icp_control_init(target_phys_addr_t base)
> >  {
> > -    int iomemtype;
> > +    MemoryRegion *io;
> >
> > -    iomemtype = cpu_register_io_memory(icp_control_readfn,
> > -                                       icp_control_writefn, NULL,
> > -                                       DEVICE_NATIVE_ENDIAN);
> > -    cpu_register_physical_memory(base, 0x00800000, iomemtype);
> > +    io = (MemoryRegion *)g_malloc0(sizeof(MemoryRegion));
> > +    memory_region_init_io(io, &icp_control_ops, NULL,
> > +                          "control", 0x00800000);
> > +    memory_region_add_subregion(get_system_memory(), base, io);
> >     /* ??? Save/restore.  */
> >  }
>
> I didn't spot this the first time round, but this is wrong.
> We shouldn't be g_malloc0()ing the MemoryRegion -- it should
> be an element in some suitable device struct.
>
> I think the right thing to do here is probably first to do the
> (fairly trivial) conversion of the icp_control code to be a
> sysbus device, then do the memory region conversion on top of that.

It's not any less wrong than the original code, which also leaked
memory.  I'll merge it and let any further conversion take place on top.

(though g_malloc0() is better replaced by g_new()).

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-10-18 14:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-17 15:28 [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris to memory API Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 1/7] integratorcp: convert core " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic " Benoît Canet
2011-10-18 11:37   ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 3/7] integratorcp: convert control " Benoît Canet
2011-10-18 11:44   ` Peter Maydell
2011-10-18 14:06     ` Avi Kivity [this message]
2011-10-18 14:32       ` Avi Kivity
2011-10-18 14:54         ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 4/7] stellaris: convert sys " Benoît Canet
2011-10-18 11:37   ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 5/7] stellaris: convert i2c " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 6/7] stellaris: convert adc " Benoît Canet
2011-10-18 11:36   ` Peter Maydell
2011-10-17 15:28 ` [Qemu-devel] [PATCH 7/7] stellaris: convert gptm " Benoît Canet
2011-10-19 10:54 ` [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris " Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2011-10-13 19:45 [Qemu-devel] [PATCH] finish to convert integratorcp.c and stellaris.c to the new " Benoît Canet
2011-10-13 19:45 ` [Qemu-devel] [PATCH 3/7] integratorcp: convert control to " Benoît Canet
2011-10-17 14:17   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E9D87F3.4010901@redhat.com \
    --to=avi@redhat.com \
    --cc=benoit.canet@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).