From patchwork Fri May 17 06:49:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 164410 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp1794206ili; Thu, 16 May 2019 23:50:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1nS97MRtQbz10vxd6FBSpBvUhDo2jPkzjWcK4HN50XhcMaXRnqG4S7XDClvSrp3/4/FdJ X-Received: by 2002:a63:a08:: with SMTP id 8mr54351324pgk.46.1558075810107; Thu, 16 May 2019 23:50:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558075810; cv=none; d=google.com; s=arc-20160816; b=d7RC3LPK7kKe918wOXJe8w21PLJDACpI2V07CZ2eGlQk8mQNrkxUJI/Bch1UyTpzaS pwAgRNb61ymOuno6D6YMb3bNV1lgKZwgq5mVmEGcZaIhD5Yqtm3j5HJ+aWOoVxI0l/Ss CcbZV2G2N64EJwbtrA2/D/qO8BZ2wBGqUh6BlHIboWUf3845T0/gZjlMZT4/cRgUGeXw DPK8PzT8mCBSfPkENEOTDvdDYtC7Wka0Hu6cZmmzk9DVIQLWktQGKwS1i2m6kI4g2KDB Fz3WfQcnKWdYE6urloslVEmvD1K6WCr1kNLMQtVY+4Rk4nfJhFVjPo1h9RJblxPjOaNr k/tA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=N1B2j8YTLhqQwcpZvsbGQ/rqXqS3XcNo6ROsyEynx48=; b=BUF8sz6RqqJERLgMfmQMFcn6Hn6Ci2ug2M5PIxQe4zBNBkaUo4eHbXa8eJaRHZFgtc 3BdjZcBU6AD9hQTrDHgQrFMuJ7C0P54jFMdFKP5KAs+2Ono5Q6QtbDCnpmNuKjEBXW6n n+8hRG+USHgbBTGXD4Tirg8jExhvbKPQbUWqzOsA+4kiNvsn8ox/Qwt2YAemPHDQqRLb G8V0N4tS4bHz2PZ0P4fUMCPQ4kRzMZDXGuxjx3BTYw/anMKQ2hYKVNRtjsAwd6f3M/o9 SzXyfHujwtQcUNZ/DpSU9FNEdSjrRWQHMhd4b3K3hj7nTzCgGfGIaF8kdd/uQ80S8yXu 4bWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=LZNk7Xov; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h40si7627082plb.243.2019.05.16.23.50.09; Thu, 16 May 2019 23:50:10 -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=@nifty.com header.s=dec2015msa header.b=LZNk7Xov; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728096AbfEQGuJ (ORCPT + 30 others); Fri, 17 May 2019 02:50:09 -0400 Received: from conuserg-11.nifty.com ([210.131.2.78]:52613 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbfEQGuI (ORCPT ); Fri, 17 May 2019 02:50:08 -0400 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id x4H6nWQD001015; Fri, 17 May 2019 15:49:32 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com x4H6nWQD001015 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1558075773; bh=N1B2j8YTLhqQwcpZvsbGQ/rqXqS3XcNo6ROsyEynx48=; h=From:To:Cc:Subject:Date:From; b=LZNk7XovCLIA/bkEo6VNizTpoEvpmo5lFBNWowQJHJefloaGu5KxW5l878vpMWSz2 HVFz2xYL7AsO6cFu9z1DJLdERlIdT84bU2dJ7aqG6QLvU615/LfYDpShUXM63nfDrj 9N50haB7RV10KMy9mvoDjx04sViO5TrdheoozQkNY1Ry2SIGG+AYmNC8w955sTM9FN ezqFIUz8La7izHgU6YUSToj/MzZQXN0sLpI8OFVPoKfjeg0j1KB8gIB1XNVkc5rEXk SGfJywUELWcNdagBjcZnujUo8zQ3z54PFXQ5ejnw9+hFtMkeZBFncKCYl32ePxlqDw Z9cbJjWHMQ0FA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Martin Schwidefsky , Heiko Carstens , linux-s390@vger.kernel.org Cc: Arnd Bergmann , Masahiro Yamada , Claudio Imbrenda , linux-kernel@vger.kernel.org, Gerald Schaefer , Souptick Joarder , Sergey Senozhatsky , Philipp Rudo Subject: [PATCH] s390: add unreachable() to dump_fault_info() to fix -Wmaybe-uninitialized Date: Fri, 17 May 2019 15:49:22 +0900 Message-Id: <20190517064922.22743-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_OPTIMIZE_INLINING is enabled for s390, I see this warning: arch/s390/mm/fault.c:127:15: warning: 'asce' may be used uninitialized in this function [-Wmaybe-uninitialized] switch (asce & _ASCE_TYPE_MASK) { arch/s390/mm/fault.c:177:16: note: 'asce' was declared here unsigned long asce; ^~~~ If get_fault_type() is not inlined, the compiler cannot deduce that all the possible paths in the 'switch' statement are covered. Of course, we could mark get_fault_type() as __always_inline to get back the original behavior, but I do not think it sensible to force inlining just for the purpose of suppressing the warning. Since this is just a matter of warning, I want to keep as much room for compiler optimization as possible. I added unreachable() to teach the compiler that the 'default' label is unreachable. I got rid of the 'inline' marker. Even without the 'inline' hint, the compiler inlines functions based on its inlining heuristic. Fixes: 9012d011660e ("compiler: allow all arches to enable CONFIG_OPTIMIZE_INLINING") Signed-off-by: Masahiro Yamada --- arch/s390/mm/fault.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index c220399ae196..91ce03fd0c84 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c @@ -85,7 +85,7 @@ static inline int notify_page_fault(struct pt_regs *regs) * Find out which address space caused the exception. * Access register mode is impossible, ignore space == 3. */ -static inline enum fault_type get_fault_type(struct pt_regs *regs) +static enum fault_type get_fault_type(struct pt_regs *regs) { unsigned long trans_exc_code; @@ -211,6 +211,8 @@ static void dump_fault_info(struct pt_regs *regs) asce = S390_lowcore.kernel_asce; pr_cont("kernel "); break; + default: + unreachable(); } pr_cont("ASCE.\n"); dump_pagetable(asce, regs->int_parm_long & __FAIL_ADDR_MASK);