From patchwork Wed Oct 17 19:35:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 192132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 571B32C0096 for ; Thu, 18 Oct 2012 06:54:17 +1100 (EST) Received: from localhost ([::1]:42458 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZPD-00030O-R0 for incoming@patchwork.ozlabs.org; Wed, 17 Oct 2012 15:35:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40610) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZOi-0001sb-Dp for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOZOd-0001aC-VA for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOZOd-0001Zw-Lp for qemu-devel@nongnu.org; Wed, 17 Oct 2012 15:35:15 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9HJZEPS021568 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 17 Oct 2012 15:35:15 -0400 Received: from localhost (ovpn-113-93.phx2.redhat.com [10.3.113.93]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9HJZDqD001520; Wed, 17 Oct 2012 15:35:14 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 17 Oct 2012 16:35:54 -0300 Message-Id: <1350502556-4885-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1350502556-4885-1-git-send-email-lcapitulino@redhat.com> References: <1350502556-4885-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, pbonzini@redhat.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 6/8] qemu-img: img_create(): simplify 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Drop unneeded goto and ret variable. Signed-off-by: Luiz Capitulino --- qemu-img.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index dfde588..0634402 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -294,7 +294,7 @@ static int add_old_style_options(const char *fmt, QEMUOptionParameter *list, static int img_create(int argc, char **argv) { - int c, ret = 0; + int c; uint64_t img_size = -1; const char *fmt = "raw"; const char *base_fmt = NULL; @@ -352,15 +352,13 @@ static int img_create(int argc, char **argv) error_report("Invalid image size specified! You may use k, M, G or " "T suffixes for "); error_report("kilobytes, megabytes, gigabytes and terabytes."); - ret = -1; - goto out; + return 1; } img_size = (uint64_t)sval; } if (options && is_help_option(options)) { - ret = print_block_option_help(filename, fmt); - goto out; + return print_block_option_help(filename, fmt); } bdrv_img_create(filename, fmt, base_filename, base_fmt, @@ -368,8 +366,7 @@ static int img_create(int argc, char **argv) if (error_is_set(&local_err)) { fprintf(stderr, "qemu-img: %s\n", error_get_pretty(local_err)); error_free(local_err); - ret = -1; - goto out; + return 1; } assert(params); @@ -378,10 +375,6 @@ static int img_create(int argc, char **argv) free_option_parameters(params); puts(""); -out: - if (ret) { - return 1; - } return 0; }