From patchwork Fri Jun 16 13:37:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 776753 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wq1fm4gwmz9s7M for ; Fri, 16 Jun 2017 23:38:40 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="L5CAbD33"; dkim-atps=neutral Received: from localhost ([::1]:58935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLrSQ-00053Z-7w for incoming@patchwork.ozlabs.org; Fri, 16 Jun 2017 09:38:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLrRd-00051f-CM for qemu-devel@nongnu.org; Fri, 16 Jun 2017 09:37:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLrRY-0000gH-F8 for qemu-devel@nongnu.org; Fri, 16 Jun 2017 09:37:49 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:35105) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLrRX-0000eH-VB; Fri, 16 Jun 2017 09:37:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=T1Qp8CjRCR/K9SRw8VNuVCHPXjuSZ6FWvb71Bif3lWI=; b=L5CAbD33Mf939sT3w1LgoLDpSWcoxfRSGahbgO1HDFJKIWe/yIuIv5lkRUXPAnHpanP6v6clyp3BbvBwShAveNckL/udL4PpuwDoiL+HI5cHRsEWbRZctorC8LAy0nOrkwM8zLXd1l31xFOwARrXoPCoiFQSg20PBN0MkQ0XzWsl8eFOalXfYhTHympgkZoVPD0zpiMW9kgbGeB3qpP0fpuEcJaARSCbPq2AJI3c0/S5OwKHKklAPoRaic5U2PFM+3xxd0lrbhlPM3oPZhk9Je0QyNH7I4Qi0oreycXLTZbcsoNEfOGVCLcSh5fO/GAiNlHb1NGuRRnmectDXpfYeg==; Received: from [194.100.51.2] (helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1dLrRU-0003tG-T4; Fri, 16 Jun 2017 15:37:41 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1dLrRD-00018v-3F; Fri, 16 Jun 2017 16:37:23 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Fri, 16 Jun 2017 16:37:01 +0300 Message-Id: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH v3 1/7] qcow2: Remove unused Error variable in do_perform_cow() 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-block@nongnu.org, Max Reitz , Stefan Hajnoczi , "Denis V . Lunev" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We are using the return value of qcow2_encrypt_sectors() to detect problems but we are throwing away the returned Error since we have no way to report it to the user. Therefore we can simply get rid of the local Error variable and pass NULL instead. Alternatively we could try to figure out a way to pass the original error instead of simply returning -EIO, but that would be more invasive, so let's keep the current approach. Signed-off-by: Alberto Garcia Reviewed-by: Eric Blake --- block/qcow2-cluster.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c index d779ea19cf..d1c419f52b 100644 --- a/block/qcow2-cluster.c +++ b/block/qcow2-cluster.c @@ -440,16 +440,14 @@ static int coroutine_fn do_perform_cow(BlockDriverState *bs, } if (bs->encrypted) { - Error *err = NULL; int64_t sector = (src_cluster_offset + offset_in_cluster) >> BDRV_SECTOR_BITS; assert(s->cipher); assert((offset_in_cluster & ~BDRV_SECTOR_MASK) == 0); assert((bytes & ~BDRV_SECTOR_MASK) == 0); if (qcow2_encrypt_sectors(s, sector, iov.iov_base, iov.iov_base, - bytes >> BDRV_SECTOR_BITS, true, &err) < 0) { + bytes >> BDRV_SECTOR_BITS, true, NULL) < 0) { ret = -EIO; - error_free(err); goto out; } }