From patchwork Sat Jun 21 14:59:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Gang X-Patchwork-Id: 362447 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 4E90614007D for ; Sun, 22 Jun 2014 01:00:15 +1000 (EST) Received: from localhost ([::1]:45421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyMm5-0006DJ-Cy for incoming@patchwork.ozlabs.org; Sat, 21 Jun 2014 11:00:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46410) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyMlZ-0005ih-Qm for qemu-devel@nongnu.org; Sat, 21 Jun 2014 10:59:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WyMlQ-0004SQ-PJ for qemu-devel@nongnu.org; Sat, 21 Jun 2014 10:59:41 -0400 Received: from mail-pb0-x22d.google.com ([2607:f8b0:400e:c01::22d]:37229) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WyMlQ-0004SA-J0; Sat, 21 Jun 2014 10:59:32 -0400 Received: by mail-pb0-f45.google.com with SMTP id rr13so4149925pbb.32 for ; Sat, 21 Jun 2014 07:59:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=blbhI+EfzCaLiNNGSXnxyUs1BBHQKGrcg/dx7Zy/LcE=; b=UaDtz8WgUdW78AzM6yaawO14umdBeRRRBlj9PbNWJOduMyr/2jUCodAeP56aIKX/9O blLBV5tQqPewJgLcXTtriEQ0yysOs+Uhkhg8y1QIGOMudlIdHWndDCn6HCKnuYc0Q8LM sOO/KjsK/tsIR2bm9EChm2a82XXykeTbrF4V+qu2Bk6FwhlsDYPV0/jlbDw4HS/Pluu5 q8rxMDahixbCI6wYQQmyjhjoyYHTjbVeFXm0k/iQmmWl8zUMkzciwdqtdIypZPG9BSAp TYGr/LvhJJbg4/mf+OIUPT9ElPp2mFOd7EZZ7c0l5a7rz/9iXqtLnG9m2+E/W2L/qA1p feag== X-Received: by 10.68.139.194 with SMTP id ra2mr13737065pbb.20.1403362771336; Sat, 21 Jun 2014 07:59:31 -0700 (PDT) Received: from [192.168.1.101] ([223.72.65.76]) by mx.google.com with ESMTPSA id eh4sm18538107pbc.79.2014.06.21.07.59.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 21 Jun 2014 07:59:30 -0700 (PDT) Message-ID: <53A59DD1.2020706@gmail.com> Date: Sat, 21 Jun 2014 22:59:29 +0800 From: Chen Gang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: kwolf@redhat.com, stefanha@redhat.com, Michael Tokarev X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c01::22d Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH trivial] block.c: Correct the return value and the failure object when failure occurs 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 When failure occurs, 'ret' need be set, or may return 0 to indicate success. And error_propagate() also need be called only one time within a function. Signed-off-by: Chen Gang --- block.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block.c b/block.c index 74af8d7..12ce4e4 100644 --- a/block.c +++ b/block.c @@ -1497,7 +1497,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename, if (snapshot_flags) { bdrv_append_temp_snapshot(bs, snapshot_flags, &local_err); if (local_err) { - error_propagate(errp, local_err); + ret = -1; goto close_and_fail; } }