From patchwork Wed Sep 19 16:41:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 185106 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 F3D7A2C0085 for ; Thu, 20 Sep 2012 02:41:36 +1000 (EST) Received: from localhost ([::1]:48801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TENLD-0006TL-4D for incoming@patchwork.ozlabs.org; Wed, 19 Sep 2012 12:41:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TENL0-0006TC-Pn for qemu-devel@nongnu.org; Wed, 19 Sep 2012 12:41:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TENKu-0005Qk-Rh for qemu-devel@nongnu.org; Wed, 19 Sep 2012 12:41:22 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:42115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TENKu-0005QO-LP; Wed, 19 Sep 2012 12:41:16 -0400 Received: from localhost (v220110690675601.yourvserver.net.local [127.0.0.1]) by v220110690675601.yourvserver.net (Postfix) with ESMTP id 581837280032; Wed, 19 Sep 2012 18:41:15 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at weilnetz.de Received: from v220110690675601.yourvserver.net ([127.0.0.1]) by localhost (v220110690675601.yourvserver.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n3nybJ2Ld3xM; Wed, 19 Sep 2012 18:41:15 +0200 (CEST) Received: by v220110690675601.yourvserver.net (Postfix, from userid 1000) id F2DBB7280033; Wed, 19 Sep 2012 18:41:14 +0200 (CEST) From: Stefan Weil To: qemu-devel@nongnu.org Date: Wed, 19 Sep 2012 18:41:14 +0200 Message-Id: <1348072874-2096-1-git-send-email-sw@weilnetz.de> X-Mailer: git-send-email 1.7.10 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 78.47.199.172 Cc: qemu-trivial@nongnu.org, Stefan Weil Subject: [Qemu-devel] [PATCH] pflash: Avoid warnings from coverity 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 hw/pflash_cfi01.c:209: check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times). hw/pflash_cfi02.c:144: unterminated_default: The default case is not terminated by a 'break' statement. hw/pflash_cfi02.c:238: check_return: Calling function "bdrv_write" without checking return value (as is done elsewhere 35 out of 37 times). Signed-off-by: Stefan Weil --- hw/pflash_cfi01.c | 6 ++++-- hw/pflash_cfi02.c | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index 56ed33f..27ae4aa 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -205,8 +205,10 @@ static void pflash_update(pflash_t *pfl, int offset, /* round to sectors */ offset = offset >> 9; offset_end = (offset_end + 511) >> 9; - bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), - offset_end - offset); + if (bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), + offset_end - offset) == -1) { + fprintf(stderr, "pflash: Error writing to flash storage\n"); + } } } diff --git a/hw/pflash_cfi02.c b/hw/pflash_cfi02.c index 3e2002e..bca7d1b 100644 --- a/hw/pflash_cfi02.c +++ b/hw/pflash_cfi02.c @@ -147,6 +147,7 @@ static uint32_t pflash_read (pflash_t *pfl, target_phys_addr_t offset, DPRINTF("%s: unknown command state: %x\n", __func__, pfl->cmd); pfl->wcycle = 0; pfl->cmd = 0; + /* Fall through */ case 0x80: /* We accept reads during second unlock sequence... */ case 0x00: @@ -236,8 +237,10 @@ static void pflash_update(pflash_t *pfl, int offset, /* round to sectors */ offset = offset >> 9; offset_end = (offset_end + 511) >> 9; - bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), - offset_end - offset); + if (bdrv_write(pfl->bs, offset, pfl->storage + (offset << 9), + offset_end - offset) == -1) { + fprintf(stderr, "pflash: Error writing to flash storage\n"); + } } }