From patchwork Fri Feb 19 18:13:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Huang X-Patchwork-Id: 8363341 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D88DCC0553 for ; Fri, 19 Feb 2016 18:13:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D25D2053F for ; Fri, 19 Feb 2016 18:13:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74C992053D for ; Fri, 19 Feb 2016 18:13:24 +0000 (UTC) Received: from localhost ([::1]:54401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWpYR-0005Q7-Er for patchwork-qemu-devel@patchwork.kernel.org; Fri, 19 Feb 2016 13:13:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52860) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWpYI-0005Q0-JL for qemu-devel@nongnu.org; Fri, 19 Feb 2016 13:13:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWpYE-0003sd-J8 for qemu-devel@nongnu.org; Fri, 19 Feb 2016 13:13:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43607) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWpYE-0003rx-ES; Fri, 19 Feb 2016 13:13:10 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 1DE8FBE02E; Fri, 19 Feb 2016 18:13:09 +0000 (UTC) Received: from rhlaptop.redhat.com (vpn-61-139.rdu2.redhat.com [10.10.61.139]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u1JID812024416; Fri, 19 Feb 2016 13:13:08 -0500 From: Wei Huang To: qemu-devel@nongnu.org Date: Fri, 19 Feb 2016 12:13:07 -0600 Message-Id: <1455905587-4347-1-git-send-email-wei@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: qemu-trivial@nongnu.org, mst@redhat.com Subject: [Qemu-devel] [PATCH 1/1] virtio-rng: fix condition checking on period_ms X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The condition checking on vrng->conf.period_ms appears to be wrong, conflicting with the error comment following it. Signed-off-by: Wei Huang --- 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..a06427c 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; }