From patchwork Sun Sep 23 10:00:13 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 186202 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 B9A142C0088 for ; Sun, 23 Sep 2012 20:44:43 +1000 (EST) Received: from localhost ([::1]:47030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFj09-0005nT-Uf for incoming@patchwork.ozlabs.org; Sun, 23 Sep 2012 06:01:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizS-0004Aj-Cb for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TFizQ-0007dp-RV for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:42 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:56983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TFizQ-0007dj-EG for qemu-devel@nongnu.org; Sun, 23 Sep 2012 06:00:40 -0400 Received: by wibhq12 with SMTP id hq12so116677wib.10 for ; Sun, 23 Sep 2012 03:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=zAanTixfMNebi28ghN5PJvhL1xzdt77Zv+frN3IBbXc=; b=UwnsFYVI6vJPn6KMC8CM/r06TqXcz7ndAldXUMNn/V4nZKQoQ3qbCZtpcI1Y60Jl4b zDrl6kcIUbNqtHdlZlMdmQ4w16fMfEDRK1wMr7bl4S+V8a+8BAW0O526tIazM5U6McMt X51Lik5zvaFm/l4YqFDU8o1Kj5zv03VFq9oWVnwdVajZsSLkmeRh3kf4eJJzpr6cjtw2 EboKTfCnSB+2yoV1uR2oIInoHHoOK57PvETfh3Xbq5Dfex1JRdBqt07+U5haqJsk1deg 8UnNW8vDT23psAnXiT7CWRAqdfrpaAV9k2aUm8DEIIFB1lBGS16U+iwArAswpTqsrCfo ie5g== Received: by 10.216.211.106 with SMTP id v84mr5973630weo.145.1348394439520; Sun, 23 Sep 2012 03:00:39 -0700 (PDT) Received: from localhost ([109.224.133.37]) by mx.google.com with ESMTPS id m14sm1462868wie.8.2012.09.23.03.00.38 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 23 Sep 2012 03:00:39 -0700 (PDT) From: Stefan Hajnoczi To: Anthony Liguori Date: Sun, 23 Sep 2012 11:00:13 +0100 Message-Id: <1348394420-28298-8-git-send-email-stefanha@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1348394420-28298-1-git-send-email-stefanha@gmail.com> References: <1348394420-28298-1-git-send-email-stefanha@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.212.181 Cc: Stefan Weil , qemu-devel@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 07/14] pflash_cfi01: Fix warning caused by unreachable code 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 From: Stefan Weil Report from smatch: hw/pflash_cfi01.c:431 pflash_write(180) info: ignoring unreachable code. Instead of removing the return statement after the switch statement, the patch replaces the return statements in the switch statement by break statements. Other switch statements in the same code do it also like that. Signed-off-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- hw/pflash_cfi01.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/pflash_cfi01.c b/hw/pflash_cfi01.c index 9c42d31..855890d 100644 --- a/hw/pflash_cfi01.c +++ b/hw/pflash_cfi01.c @@ -321,7 +321,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, } pfl->wcycle++; pfl->cmd = cmd; - return; + break; case 1: switch (pfl->cmd) { case 0x10: /* Single Byte Program */ @@ -376,7 +376,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; case 2: switch (pfl->cmd) { case 0xe8: /* Block write */ @@ -407,7 +407,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; case 3: /* Confirm mode */ switch (pfl->cmd) { case 0xe8: /* Block write */ @@ -423,7 +423,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset, default: goto error_flash; } - return; + break; default: /* Should never happen */ DPRINTF("%s: invalid write state\n", __func__);