From patchwork Tue May 17 14:41:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 9112991 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3A5E09F1C3 for ; Tue, 17 May 2016 14:44:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 915E12022D for ; Tue, 17 May 2016 14:44:10 +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 CC3AA2012D for ; Tue, 17 May 2016 14:44:09 +0000 (UTC) Received: from localhost ([::1]:50660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2gEC-0000S1-Sz for patchwork-qemu-devel@patchwork.kernel.org; Tue, 17 May 2016 10:44:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55588) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2gCB-0004Y5-IJ for qemu-devel@nongnu.org; Tue, 17 May 2016 10:42:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b2gC9-0005nC-F2 for qemu-devel@nongnu.org; Tue, 17 May 2016 10:42:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b2gC5-0005lh-VR; Tue, 17 May 2016 10:41:58 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 885B8C087334; Tue, 17 May 2016 14:41:57 +0000 (UTC) Received: from localhost (ovpn-116-69.ams2.redhat.com [10.36.116.69]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4HEft0l026344 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 17 May 2016 10:41:57 -0400 From: Max Reitz To: qemu-block@nongnu.org Date: Tue, 17 May 2016 16:41:34 +0200 Message-Id: <1463496094-21608-10-git-send-email-mreitz@redhat.com> In-Reply-To: <1463496094-21608-1-git-send-email-mreitz@redhat.com> References: <1463496094-21608-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 17 May 2016 14:41:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 9/9] block: Drop errp parameter from blk_new() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" 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 blk_new() cannot fail so its Error ** parameter has become superfluous. Signed-off-by: Max Reitz --- block/block-backend.c | 9 ++------- blockdev.c | 6 +----- include/sysemu/block-backend.h | 2 +- tests/test-throttle.c | 6 +++--- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 2a85120..75a988c 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -119,7 +119,7 @@ static const BdrvChildRole child_root = { * Store an error through @errp on failure, unless it's null. * Return the new BlockBackend on success, null on failure. */ -BlockBackend *blk_new(Error **errp) +BlockBackend *blk_new(void) { BlockBackend *blk; @@ -153,12 +153,7 @@ BlockBackend *blk_new_open(const char *filename, const char *reference, BlockBackend *blk; BlockDriverState *bs; - blk = blk_new(errp); - if (!blk) { - QDECREF(options); - return NULL; - } - + blk = blk_new(); bs = bdrv_open(filename, reference, options, flags, errp); if (!bs) { blk_unref(blk); diff --git a/blockdev.c b/blockdev.c index 077d5b5..d4317d4 100644 --- a/blockdev.c +++ b/blockdev.c @@ -567,11 +567,7 @@ static BlockBackend *blockdev_init(const char *file, QDict *bs_opts, if ((!file || !*file) && !qdict_size(bs_opts)) { BlockBackendRootState *blk_rs; - blk = blk_new(errp); - if (!blk) { - goto early_err; - } - + blk = blk_new(); blk_rs = blk_get_root_state(blk); blk_rs->open_flags = bdrv_flags; blk_rs->read_only = !(bdrv_flags & BDRV_O_RDWR); diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index d0db3c3..9d6615c 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -78,7 +78,7 @@ typedef struct BlockBackendPublic { QLIST_ENTRY(BlockBackendPublic) round_robin; } BlockBackendPublic; -BlockBackend *blk_new(Error **errp); +BlockBackend *blk_new(void); BlockBackend *blk_new_open(const char *filename, const char *reference, QDict *options, int flags, Error **errp); int blk_get_refcnt(BlockBackend *blk); diff --git a/tests/test-throttle.c b/tests/test-throttle.c index d7fb0a6..c02be80 100644 --- a/tests/test-throttle.c +++ b/tests/test-throttle.c @@ -578,9 +578,9 @@ static void test_groups(void) BlockBackend *blk1, *blk2, *blk3; BlockBackendPublic *blkp1, *blkp2, *blkp3; - blk1 = blk_new(&error_abort); - blk2 = blk_new(&error_abort); - blk3 = blk_new(&error_abort); + blk1 = blk_new(); + blk2 = blk_new(); + blk3 = blk_new(); blkp1 = blk_get_public(blk1); blkp2 = blk_get_public(blk2);