From patchwork Thu Jan 24 11:16:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 10778751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1E3F13B5 for ; Thu, 24 Jan 2019 11:17:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1F7E2E9D4 for ; Thu, 24 Jan 2019 11:17:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C65072EB51; Thu, 24 Jan 2019 11:17:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F1062E9D4 for ; Thu, 24 Jan 2019 11:17:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727624AbfAXLRD (ORCPT ); Thu, 24 Jan 2019 06:17:03 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54778 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727633AbfAXLRD (ORCPT ); Thu, 24 Jan 2019 06:17:03 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E52391596; Thu, 24 Jan 2019 03:17:02 -0800 (PST) Received: from login12.euhpc.arm.com (login12.euhpc.arm.com [10.6.27.168]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D447C3F237; Thu, 24 Jan 2019 03:17:01 -0800 (PST) From: Alexandru Elisei To: kvm@vger.kernel.org Cc: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com, vladimir.murzin@arm.com Subject: [kvm-unit-tests PATCH 3/7] lib: chr-testdev: Make chr_testdev_init() return status Date: Thu, 24 Jan 2019 11:16:30 +0000 Message-Id: <20190124111634.4727-4-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190124111634.4727-1-alexandru.elisei@arm.com> References: <20190124111634.4727-1-alexandru.elisei@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Make chr_testdev_init() return 0 (success) if the virtio console was initialized properly, otherwise return -1 (failure). Signed-off-by: Alexandru Elisei --- lib/chr-testdev.h | 2 +- lib/chr-testdev.c | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/chr-testdev.h b/lib/chr-testdev.h index ffd9a851aa9b..fdd0582e2da1 100644 --- a/lib/chr-testdev.h +++ b/lib/chr-testdev.h @@ -9,6 +9,6 @@ * * This work is licensed under the terms of the GNU LGPL, version 2. */ -extern void chr_testdev_init(void); +extern int chr_testdev_init(void); extern void chr_testdev_exit(int code); #endif diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c index 6890f63c8b29..26e14301e3db 100644 --- a/lib/chr-testdev.c +++ b/lib/chr-testdev.c @@ -47,7 +47,7 @@ out: spin_unlock(&lock); } -void chr_testdev_init(void) +int chr_testdev_init(void) { const char *io_names[] = { "input", "output" }; struct virtqueue *vqs[2]; @@ -57,7 +57,7 @@ void chr_testdev_init(void) if (vcon == NULL) { printf("%s: %s: can't find a virtio-console\n", __func__, TESTDEV_NAME); - return; + return -1; } ret = vcon->config->find_vqs(vcon, 2, vqs, NULL, io_names); @@ -65,9 +65,11 @@ void chr_testdev_init(void) printf("%s: %s: can't init virtqueues\n", __func__, TESTDEV_NAME); vcon = NULL; - return; + return -1; } in_vq = vqs[0]; out_vq = vqs[1]; + + return 0; }