diff mbox

[3/3] virtio: Define max_nr_ports to unsigned

Message ID 20110615142541.26726.42629.stgit@localhost6.localdomain6 (mailing list archive)
State New, archived
Headers show

Commit Message

Amos Kong June 15, 2011, 2:25 p.m. UTC
hw/virtio-serial-bus.c:
725 static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
726 {
...
730     int ret, max_nr_ports;
...
762     max_nr_ports = tswap32(port->vser->config.max_nr_ports);
763     if (port->id >= max_nr_ports) {

tswap32() returns an uint32_t variable.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/virtio-serial-bus.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


--
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

Comments

Michael S. Tsirkin June 15, 2011, 8:39 p.m. UTC | #1
On Wed, Jun 15, 2011 at 10:25:41PM +0800, Amos Kong wrote:
> hw/virtio-serial-bus.c:
> 725 static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
> 726 {
> ...
> 730     int ret, max_nr_ports;
> ...
> 762     max_nr_ports = tswap32(port->vser->config.max_nr_ports);
> 763     if (port->id >= max_nr_ports) {
> 
> tswap32() returns an uint32_t variable.
> 
> Signed-off-by: Amos Kong <akong@redhat.com>

I guess 2^31 ports isn't really feasible, but it's good
to be consistent.

Acked-by: Michael S. Tsirkin <mst@redhat.com>


> ---
>  hw/virtio-serial-bus.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
> index 9a12104..aae8456 100644
> --- a/hw/virtio-serial-bus.c
> +++ b/hw/virtio-serial-bus.c
> @@ -727,7 +727,8 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
>      VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
>      VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base);
>      VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus);
> -    int ret, max_nr_ports;
> +    int ret;
> +    uint32_t max_nr_ports;
>      bool plugging_port0;
>  
>      port->vser = bus->vser;
--
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/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 9a12104..aae8456 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -727,7 +727,8 @@  static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
     VirtIOSerialPort *port = DO_UPCAST(VirtIOSerialPort, dev, qdev);
     VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev, base);
     VirtIOSerialBus *bus = DO_UPCAST(VirtIOSerialBus, qbus, qdev->parent_bus);
-    int ret, max_nr_ports;
+    int ret;
+    uint32_t max_nr_ports;
     bool plugging_port0;
 
     port->vser = bus->vser;