From patchwork Wed May 25 17:39:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 9135975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 02D556075C for ; Wed, 25 May 2016 17:51:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDC04280BB for ; Wed, 25 May 2016 17:51:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2A022829C; Wed, 25 May 2016 17:51:09 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 8C47A280BB for ; Wed, 25 May 2016 17:51:09 +0000 (UTC) Received: from localhost ([::1]:34350 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5cxY-0006hB-FG for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 May 2016 13:51:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5cnP-0005kc-FY for qemu-devel@nongnu.org; Wed, 25 May 2016 13:40:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b5cnN-0004Vf-EY for qemu-devel@nongnu.org; Wed, 25 May 2016 13:40:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35092) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b5cnF-0004QL-EZ; Wed, 25 May 2016 13:40:29 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (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 020A58B135; Wed, 25 May 2016 17:40:28 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-86.ams2.redhat.com [10.36.116.86]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4PHeAtS024245; Wed, 25 May 2016 13:40:27 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 25 May 2016 19:39:35 +0200 Message-Id: <1464197996-4581-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1464197996-4581-1-git-send-email-kwolf@redhat.com> References: <1464197996-4581-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 25 May 2016 17:40:29 +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] [PULL 10/31] 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: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Max Reitz blk_new() cannot fail so its Error ** parameter has become superfluous. Signed-off-by: Max Reitz Signed-off-by: Kevin Wolf --- 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 bc1f071..4e8298b 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 7d4a1ba..af0b022 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);