diff mbox

[1/1] virtio-rng: fix check for period_ms validity

Message ID 236dc0c1f599c40fd608de173e08402e0d43a1b6.1418284167.git.amit.shah@redhat.com
State New
Headers show

Commit Message

Amit Shah Dec. 11, 2014, 7:49 a.m. UTC
This was reported for this warning:

hw/virtio/virtio-rng.c:150:31: warning: logical not is only applied to
the left hand side of comparison [-Wlogical-not-parentheses]

Reported-by: dcb
Suggested-by: dcb
Bug: https://bugs.launchpad.net/qemu/+bug/1393486
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 hw/virtio/virtio-rng.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Gonglei (Arei) Dec. 11, 2014, 8:14 a.m. UTC | #1
On 2014/12/11 15:49, Amit Shah wrote:

> This was reported for this warning:
> 
> hw/virtio/virtio-rng.c:150:31: warning: logical not is only applied to
> the left hand side of comparison [-Wlogical-not-parentheses]
> 
> Reported-by: dcb
> Suggested-by: dcb
> Bug: https://bugs.launchpad.net/qemu/+bug/1393486
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  hw/virtio/virtio-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Amos Kong Dec. 11, 2014, 9:38 a.m. UTC | #2
On Thu, Dec 11, 2014 at 01:19:27PM +0530, Amit Shah wrote:
> This was reported for this warning:
> 
> hw/virtio/virtio-rng.c:150:31: warning: logical not is only applied to
> the left hand side of comparison [-Wlogical-not-parentheses]
> 
> Reported-by: dcb
> Suggested-by: dcb
> Bug: https://bugs.launchpad.net/qemu/+bug/1393486
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  hw/virtio/virtio-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
> index 473c044..06e7178 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -149,7 +149,7 @@ static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
>      VirtIORNG *vrng = VIRTIO_RNG(dev);
>      Error *local_err = NULL;
>  
> -    if (!vrng->conf.period_ms > 0) {
> +    if (vrng->conf.period_ms <= 0) {

Thanks.

Reviewed-by: Amos Kong <akong@redhat.com>

>          error_setg(errp, "'period' parameter expects a positive integer");
>          return;
>      }
> -- 
> 2.1.0
diff mbox

Patch

diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 473c044..06e7178 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -149,7 +149,7 @@  static void virtio_rng_device_realize(DeviceState *dev, Error **errp)
     VirtIORNG *vrng = VIRTIO_RNG(dev);
     Error *local_err = NULL;
 
-    if (!vrng->conf.period_ms > 0) {
+    if (vrng->conf.period_ms <= 0) {
         error_setg(errp, "'period' parameter expects a positive integer");
         return;
     }