diff mbox

[01/18] kvm: qemu: fix the prototype of virtio_net_init()

Message ID 1232027262-21487-1-git-send-email-markmc@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Mark McLoughlin Jan. 15, 2009, 1:47 p.m. UTC
NIC init functions don't return a PCIDevice pointer in upstream QEMU
but they do in KVM for hotplug.

Fixes:

  qemu/hw/pci.c:740: warning: initialization from incompatible pointer type

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
---
 qemu/hw/virtio-net.c |    6 ++++--
 qemu/hw/virtio-net.h |    2 +-
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Avi Kivity Jan. 15, 2009, 1:58 p.m. UTC | #1
Mark McLoughlin wrote:
> NIC init functions don't return a PCIDevice pointer in upstream QEMU
> but they do in KVM for hotplug.
>
> Fixes:
>
>   qemu/hw/pci.c:740: warning: initialization from incompatible pointer type
>
>   

I should have caught this while merging, argh.

Applied all patches except #10, thanks.  If qemu gains a --developer 
option which enables -Werror (and if we're warning clean), I promise to 
use it.
Mark McLoughlin Jan. 15, 2009, 2:28 p.m. UTC | #2
On Thu, 2009-01-15 at 15:58 +0200, Avi Kivity wrote:
> Mark McLoughlin wrote:
> > NIC init functions don't return a PCIDevice pointer in upstream QEMU
> > but they do in KVM for hotplug.
> >
> > Fixes:
> >
> >   qemu/hw/pci.c:740: warning: initialization from incompatible pointer type
> >
> >   
> 
> I should have caught this while merging, argh.
> 
> Applied all patches except #10, thanks.  If qemu gains a --developer 
> option which enables -Werror (and if we're warning clean), I promise to 
> use it.

Yeah, it has --enable-werror, but it's not quite warning clean yet (tcg
and slirp AFAIR)

There's still a bunch more warnings in kvm-userspace that aren't in
upstream qemu - I just quickly fixed the obvious ones.

Cheers,
Mark.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index 28337c3..358c382 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -409,7 +409,7 @@  static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
     return 0;
 }
 
-void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
+PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
 {
     VirtIONet *n;
     static int virtio_net_id;
@@ -420,7 +420,7 @@  void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
                                      sizeof(struct virtio_net_config),
                                      sizeof(VirtIONet));
     if (!n)
-        return;
+        return NULL;
 
     n->vdev.get_config = virtio_net_update_config;
     n->vdev.get_features = virtio_net_get_features;
@@ -441,4 +441,6 @@  void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn)
 
     register_savevm("virtio-net", virtio_net_id++, 2,
                     virtio_net_save, virtio_net_load, n);
+
+    return (PCIDevice *)n;
 }
diff --git a/qemu/hw/virtio-net.h b/qemu/hw/virtio-net.h
index 148ec47..9ac9e34 100644
--- a/qemu/hw/virtio-net.h
+++ b/qemu/hw/virtio-net.h
@@ -80,6 +80,6 @@  struct virtio_net_hdr_mrg_rxbuf
     uint16_t num_buffers;   /* Number of merged rx buffers */
 };
 
-void virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn);
+PCIDevice *virtio_net_init(PCIBus *bus, NICInfo *nd, int devfn);
 
 #endif