From patchwork Fri Jul 26 11:27:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 169809 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp12908545ilk; Fri, 26 Jul 2019 04:27:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzT9wlHcUmTGCqhFmrrsmYXnJi35pKjGcmAyHL9MYwOoFlLzkQbltN8u4doCAKg+GdBQ7hn X-Received: by 2002:a65:448a:: with SMTP id l10mr65747928pgq.327.1564140440800; Fri, 26 Jul 2019 04:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564140440; cv=none; d=google.com; s=arc-20160816; b=y3LOlGy301YoBTAqbsLtchHOoxyd1OidNQbEKexcGridfCxyCh944c2BmYqBWTqvku xHbxni6pEw8wZ7kYVYoen+sUfz3ZEHTLyCBuMmYPULgs/PfiVixv7Udr/51xu6Mc4HTG KzARLe5NyzFXb3SxxZEdf2owxRh7/ZYUb3qkRcGWct+5gKHE8nTHUChPokAxcafrkcm9 0XyPZcOoIR8o0dPuRC4wloCjUjA6Aw2DsC2leYFH6HlMvL/X8ulJeYAeY7DK5GcRO2EA 9euUhByRCjSclKh54f3Atsd6DdLXJOcl4HjlW+e8drIx11juVuXqxZsWdd8LHtY3ExbJ KGeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Z9HY70wJXKPs0Bv25UYCD9x0V9nBKcfnlqiIvTFUOZc=; b=teAkWei9vf4fti+tkuc+cYRTlo4bakiPZACkS2yb7gMtdw29eqsyIXaFHhUWJU1OYQ BDRc27nvavSTwUfveWyVHGS8snxhuT/ogFn61wZ27wtPYShzy4M4doPY9qDOdIuq578B PrM81FNDxzmXmSvt09n/zBoTdzAaHcTy1S2vBthZXJKZRVOsj57nJxvGfP0X38H8Dsrz veDJhdc4MQTfESeikfQgSiD9whYwMZXNgNI2wdt5tU5YDIlNc3j7+tDzS4pRwR3UueuV ZYBjC8rCncx2FbHu8SCOsfUA6uIE7lB0fyfvpEF8NFmXfeL7qi10tlAO8B9yW/3NlNCJ WxKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c91SAV8u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si23744042pgs.285.2019.07.26.04.27.20; Fri, 26 Jul 2019 04:27:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=c91SAV8u; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726862AbfGZL1T (ORCPT + 29 others); Fri, 26 Jul 2019 07:27:19 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:40482 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfGZL1T (ORCPT ); Fri, 26 Jul 2019 07:27:19 -0400 Received: by mail-lf1-f68.google.com with SMTP id b17so36864385lff.7 for ; Fri, 26 Jul 2019 04:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z9HY70wJXKPs0Bv25UYCD9x0V9nBKcfnlqiIvTFUOZc=; b=c91SAV8uhLOcljWjQ8Ab9ri7kVRPcfAovbVniOu6W3Y7+7Si7G3ZkkP7PwDPvbwwZO tXE9mCuBPj28+YfwZhE9ZBUX0mlLJ2ZhgHnb9RoKMsj9lqK6gzK9osC9DQ1o3CBtbldM THIcpaGSet5VHt7d07KdP9xi4rTQVkmqyt5Q4dRIphqGXVuJvxTFnVBLNL7Ln/5KT/79 KN/XJg9iOqLN/Ht9Lmb0TwwZ6uPeZjdsSlivfBcZSR5tO3redUCcob0WqfNxyx/iHSOh ZlUePfMRzln5doV68I92erwnugKUcHqGY/U+5iwOMomiq5Tco6Z3dJtXLTcJ/2JbF9ru d+Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Z9HY70wJXKPs0Bv25UYCD9x0V9nBKcfnlqiIvTFUOZc=; b=WnxDWWfP2KyVqRVSTnjM74izqzXS19QU9PqEKZWyd14KiBvoBhQaGpZsGrQjSpKOtk OeHopQb1pSxjyx7D4UwmcbBaRcuFK4lQYN4oaxIHPSpKK1QIUton0IGNix1KNk1n6ge5 V6ycDw9dI9dOC7plsQUU7h3k/8myqP4F8PkyqtNrFXHOf35sCFuxIFMMzNRCldY4RwhA OkZWJvgWcYbGpwQLITyMw7OYsHtmfFm5mKHINnvhviWs5AQ2XEgqU/BSqr+WYPJIr0bd QPcO0BGFahNs5/tPGrScVqC0ZCdr9IJcWTtrYxlw2zUXp2yvHmySX8C8TINssC1WyEDe kPng== X-Gm-Message-State: APjAAAUWo0KSs9L3yItmfQw1tXwNoANgz9q7lGcoCJvjyWJPDny9YVyf ZWJiz0n4MJCHiN9CLHkU2a3cug== X-Received: by 2002:ac2:419a:: with SMTP id z26mr44458557lfh.21.1564140436505; Fri, 26 Jul 2019 04:27:16 -0700 (PDT) Received: from localhost (c-243c70d5.07-21-73746f28.bbcust.telenor.se. [213.112.60.36]) by smtp.gmail.com with ESMTPSA id j90sm9987780ljb.29.2019.07.26.04.27.15 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 04:27:15 -0700 (PDT) From: Anders Roxell To: maz@kernel.org, catalin.marinas@arm.com, will@kernel.org Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, Anders Roxell Subject: [PATCH 2/2] arm64: KVM: hyp: debug-sr: Mark expected switch fall-through Date: Fri, 26 Jul 2019 13:27:10 +0200 Message-Id: <20190726112710.19051-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When fall-through warnings was enabled by default the following warnings was starting to show up: ../arch/arm64/kvm/hyp/debug-sr.c: In function ‘__debug_save_state’: ../arch/arm64/kvm/hyp/debug-sr.c:20:19: warning: this statement may fall through [-Wimplicit-fallthrough=] case 15: ptr[15] = read_debug(reg, 15); \ ../arch/arm64/kvm/hyp/debug-sr.c:113:2: note: in expansion of macro ‘save_debug’ save_debug(dbg->dbg_bcr, dbgbcr, brps); ^~~~~~~~~~ ../arch/arm64/kvm/hyp/debug-sr.c:21:2: note: here case 14: ptr[14] = read_debug(reg, 14); \ ^~~~ ../arch/arm64/kvm/hyp/debug-sr.c:113:2: note: in expansion of macro ‘save_debug’ save_debug(dbg->dbg_bcr, dbgbcr, brps); ^~~~~~~~~~ ../arch/arm64/kvm/hyp/debug-sr.c:21:19: warning: this statement may fall through [-Wimplicit-fallthrough=] case 14: ptr[14] = read_debug(reg, 14); \ ../arch/arm64/kvm/hyp/debug-sr.c:113:2: note: in expansion of macro ‘save_debug’ save_debug(dbg->dbg_bcr, dbgbcr, brps); ^~~~~~~~~~ ../arch/arm64/kvm/hyp/debug-sr.c:22:2: note: here case 13: ptr[13] = read_debug(reg, 13); \ ^~~~ ../arch/arm64/kvm/hyp/debug-sr.c:113:2: note: in expansion of macro ‘save_debug’ save_debug(dbg->dbg_bcr, dbgbcr, brps); ^~~~~~~~~~ Rework to add a 'break;' where the compiler warned about fall-through. Fixes: d93512ef0f0e ("Makefile: Globally enable fall-through warning") Signed-off-by: Anders Roxell --- arch/arm64/kvm/hyp/debug-sr.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.20.1 diff --git a/arch/arm64/kvm/hyp/debug-sr.c b/arch/arm64/kvm/hyp/debug-sr.c index 26781da3ad3e..0fc9872a1467 100644 --- a/arch/arm64/kvm/hyp/debug-sr.c +++ b/arch/arm64/kvm/hyp/debug-sr.c @@ -18,40 +18,70 @@ #define save_debug(ptr,reg,nr) \ switch (nr) { \ case 15: ptr[15] = read_debug(reg, 15); \ + /* Fall through */ \ case 14: ptr[14] = read_debug(reg, 14); \ + /* Fall through */ \ case 13: ptr[13] = read_debug(reg, 13); \ + /* Fall through */ \ case 12: ptr[12] = read_debug(reg, 12); \ + /* Fall through */ \ case 11: ptr[11] = read_debug(reg, 11); \ + /* Fall through */ \ case 10: ptr[10] = read_debug(reg, 10); \ + /* Fall through */ \ case 9: ptr[9] = read_debug(reg, 9); \ + /* Fall through */ \ case 8: ptr[8] = read_debug(reg, 8); \ + /* Fall through */ \ case 7: ptr[7] = read_debug(reg, 7); \ + /* Fall through */ \ case 6: ptr[6] = read_debug(reg, 6); \ + /* Fall through */ \ case 5: ptr[5] = read_debug(reg, 5); \ + /* Fall through */ \ case 4: ptr[4] = read_debug(reg, 4); \ + /* Fall through */ \ case 3: ptr[3] = read_debug(reg, 3); \ + /* Fall through */ \ case 2: ptr[2] = read_debug(reg, 2); \ + /* Fall through */ \ case 1: ptr[1] = read_debug(reg, 1); \ + /* Fall through */ \ default: ptr[0] = read_debug(reg, 0); \ } #define restore_debug(ptr,reg,nr) \ switch (nr) { \ case 15: write_debug(ptr[15], reg, 15); \ + /* Fall through */ \ case 14: write_debug(ptr[14], reg, 14); \ + /* Fall through */ \ case 13: write_debug(ptr[13], reg, 13); \ + /* Fall through */ \ case 12: write_debug(ptr[12], reg, 12); \ + /* Fall through */ \ case 11: write_debug(ptr[11], reg, 11); \ + /* Fall through */ \ case 10: write_debug(ptr[10], reg, 10); \ + /* Fall through */ \ case 9: write_debug(ptr[9], reg, 9); \ + /* Fall through */ \ case 8: write_debug(ptr[8], reg, 8); \ + /* Fall through */ \ case 7: write_debug(ptr[7], reg, 7); \ + /* Fall through */ \ case 6: write_debug(ptr[6], reg, 6); \ + /* Fall through */ \ case 5: write_debug(ptr[5], reg, 5); \ + /* Fall through */ \ case 4: write_debug(ptr[4], reg, 4); \ + /* Fall through */ \ case 3: write_debug(ptr[3], reg, 3); \ + /* Fall through */ \ case 2: write_debug(ptr[2], reg, 2); \ + /* Fall through */ \ case 1: write_debug(ptr[1], reg, 1); \ + /* Fall through */ \ default: write_debug(ptr[0], reg, 0); \ }