From patchwork Fri Jul 26 11:28:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 11060835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBD73746 for ; Fri, 26 Jul 2019 11:31:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8B15288AF for ; Fri, 26 Jul 2019 11:31:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C95DF28922; Fri, 26 Jul 2019 11:31:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7B2352891F for ; Fri, 26 Jul 2019 11:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QZoTcEoOM0gU4u1CxBassrlWf3wATymz7REbkgzgFQg=; b=qvlJCMOFpnAzb8 svJV23pE5JheMuzCbiXtTBFZc8//BS7s7ddrflDXqVnuxER31w8aRrLXZoL3v1uuD+ivJbtUpayRL LEWTC4zpFmeGr4UXLHF/284RrsG5xIBv5eN3Znov0NTl/QhBZZcTUHq62Et+fsBg7czmPNrWrEeQT gLLCzGo5XZeG4JDaJR4LSlfpbJhrhkmMuPqkNrlbiVAy7AWTSpN/K4MrNve+t3WAxSk72xT6hlz/x w5zSqFoT5gwYQLZCKDnyjhgMNYrwFBQxscaWK1RZoJYurZq9stY7d+OE5Jb70v0xK+koMi6Gyd8Xm bRiZ4o4LIYas+LSyeG3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hqyRB-0005aP-NE; Fri, 26 Jul 2019 11:31:01 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hqyOh-0002Sm-Js for linux-arm-kernel@lists.infradead.org; Fri, 26 Jul 2019 11:28:29 +0000 Received: by mail-lj1-x241.google.com with SMTP id h10so51164156ljg.0 for ; Fri, 26 Jul 2019 04:28:27 -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=qXAXo0fvFfroRZgYWsv3eTIS6UJVzpeVoAbknFGsjMk=; b=vhHmCUXbOqW0ShlZ/0VDIpjuqPN+yllwC23Y3r37PVgVfm8QzAufXGqQE2M+e3bBXW Sa6agtYW/J24tzUmmzQjuBIoBrEixhf2OJJIwLPQWd9lzYXcR2RWUkVbv4kyj5McBBh8 VCM3fRX1y9DZW93ANmXw5P15g2/wydbxmnos6SrNyEQldDQEgLri8kEg4Rc43TnBR8aU AF47mTvHieO1vcSgJNotQg7LAhRptdA3m/4kyvTmUukb0G6X/fGd+q4RKWD6SqLlU4Ic PjQCc0/aPxCrzqEw94q1kEOcur207rRqjYV3LPtB5ntt2FqDgvmoASo8zndwPTG1O1JC GTgQ== 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=qXAXo0fvFfroRZgYWsv3eTIS6UJVzpeVoAbknFGsjMk=; b=iTZUEeqO7zA3Gdv4UmrLALxVijNeTLTLroe74601VosDK1PK7qzzqw9698+V3Ow2JN hEgqsshB5vAh10T1FsSMOyhjzlDvYaibHHUsMyRknC9MKtOnQrA7jW1odUIK9eII0wBt j5ZhsnDSRjrtlR22FVp1hCDc67BWnSE4O96Y0yuwS2fZDmyMwN7p/ZwLYI2OsQw70gYg voFTYfjyMPzddoUM2lAIu1ORTjDEjze1UcG6fBDZa+GnXnjOwB0UgCasI7/rzDh5n/LB Nn0LMzbS5sYU8k/Z5O13/dsecmj8cHAJkYze8K8IdttxGGeltihBkzcUSXOp+3kQx9fH AtNA== X-Gm-Message-State: APjAAAVAecbFsvZ2I9qi6TgYv/IOoaA3PVzD19F6OtZFm/k+m/dWUdIr 2rJwwpBzwll6yPnhfIuN4gFvdVLoHtZRNQ== X-Google-Smtp-Source: APXvYqxRcpeZfOkhl+kP2goAmuAtJQrE6rFVOEMWhCTxNELXPLbMSsa8XPVrXecSGADSpL4vrWzCFA== X-Received: by 2002:a2e:301a:: with SMTP id w26mr48094531ljw.76.1564140506079; Fri, 26 Jul 2019 04:28:26 -0700 (PDT) Received: from localhost (c-243c70d5.07-21-73746f28.bbcust.telenor.se. [213.112.60.36]) by smtp.gmail.com with ESMTPSA id s26sm10008774ljs.77.2019.07.26.04.28.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 26 Jul 2019 04:28:25 -0700 (PDT) From: Anders Roxell To: will@kernel.org, joro@8bytes.org Subject: [PATCH] iommu: arm-smmu-v3: Mark expected switch fall-through Date: Fri, 26 Jul 2019 13:28:21 +0200 Message-Id: <20190726112821.19775-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190726_042828_028995_21411A99 X-CRM114-Status: GOOD ( 10.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable@vger.kernel.org, iommu@lists.linux-foundation.org, Anders Roxell , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP When fall-through warnings was enabled by default, commit d93512ef0f0e ("Makefile: Globally enable fall-through warning"), the following warning was starting to show up: ../drivers/iommu/arm-smmu-v3.c: In function ‘arm_smmu_write_strtab_ent’: ../drivers/iommu/arm-smmu-v3.c:1189:7: warning: this statement may fall through [-Wimplicit-fallthrough=] if (disable_bypass) ^ ../drivers/iommu/arm-smmu-v3.c:1191:3: note: here default: ^~~~~~~ Rework so that the compiler doesn't warn about fall-through. Make it clearer by calling 'BUG()' when disable_bypass is set, and always 'break;' Cc: stable@vger.kernel.org # v4.2+ Fixes: 5bc0a11664e1 ("iommu/arm-smmu: Don't BUG() if we find aborting STEs with disable_bypass") Signed-off-by: Anders Roxell --- drivers/iommu/arm-smmu-v3.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index a9a9fabd3968..8e5f0565996d 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -1186,8 +1186,9 @@ static void arm_smmu_write_strtab_ent(struct arm_smmu_master *master, u32 sid, ste_live = true; break; case STRTAB_STE_0_CFG_ABORT: - if (disable_bypass) - break; + if (!disable_bypass) + BUG(); + break; default: BUG(); /* STE corruption */ }