Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2251422ybd; Mon, 24 Jun 2019 03:19:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqyfsIeSpOFl5/Vzd5C7KWrNxN59EAMaQ1MHe5/EYcqK/1HBTS7qIkEK8jO89yzomIfQOPGE X-Received: by 2002:a17:90a:1785:: with SMTP id q5mr23618774pja.106.1561371571880; Mon, 24 Jun 2019 03:19:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371571; cv=none; d=google.com; s=arc-20160816; b=I2xdegnUtxebqIX1jBhtUieyCxQd3HYS8YuFc/kqLEwQoEadBdSNNV3CymoUXQ4Vbk S8EmWMAM0lIhz6UIyoMLC00Vpr32oCuqOL953uFIa+tVfnfe8tD+olE/RwEJVSytdBAv tHu/k0f+A66VXeHHAn+VjiGIxzTYD2dGOaNXjijZDn6eSOU2YdcRx6ks/ff2UKgYB/V2 8VBHvSHowHRbgnsu0j71aEP4v2CvdmV9l0RQEOp2Q/8ygJKqUAeeCzZlWagEM/eJPWaT zJPE81lhf6sMfVq/JD+TaqK2FFJet6I2b2NR7bfI1uqyAsC+rIyyy5R02NXf1YL9ozLB COAA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6Tn5rkr9wq0uW2N/qLxodBwF9gkYpas7l+Pt4IwKOzU=; b=dfFGgPQI/K+fpIqdhrkwczzJAQOZUB2zAnaL6dA9c5U2JuqFH3+sPced4CcUB/LAcQ oBqu2O6ncIwJ9zdnU++4Qw59+U18HVuxYKT11NjVP4GRqTSiCKZKe3C53tErZzx1WV0k 5JMrJ08VAb05WZjwbY1yQqoca47rgXNh805xJ833ohXnnQiqVVaBqHVH8bShZ9AReI23 MJX3H/TEtDURjO1Ub/m7Rdpn1O4MbG1rLUeScEjD2X3KGyvyI2GHji5PWi+wkNt670Ah UhxW2pwii14RuwtDtyeaan6Mvz+Vz8DirWyLhaxpJKV0HaX+LYh0E1BViMJzwyNjKQxl T3WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BJRl8gw3; 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 68si10237451plc.269.2019.06.24.03.19.16; Mon, 24 Jun 2019 03:19:31 -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=@kernel.org header.s=default header.b=BJRl8gw3; 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 S1730686AbfFXKQN (ORCPT + 99 others); Mon, 24 Jun 2019 06:16:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:53600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729670AbfFXKQJ (ORCPT ); Mon, 24 Jun 2019 06:16:09 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 325F620645; Mon, 24 Jun 2019 10:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371368; bh=aPO68/KiexhH73GsYWwDWHSuOWmov594Nfp7HgCCThg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BJRl8gw3UuiFxdmQ5ghs1Mf3aQuD37B5jX9Cq1vn5rQy/73tf9J/luSyqVgXNwILU 5k4q5x87lut460Qot2cKOz4Ab2E5fLMWibStaS29nFjPDW+xYmhnSQAMPmcpVGKP7j DWXTuCSHUMOZokYx+SfhN9G31rLWQLPoNbr3Er1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vineet Gupta , Sasha Levin Subject: [PATCH 5.1 032/121] ARC: fix build warnings Date: Mon, 24 Jun 2019 17:56:04 +0800 Message-Id: <20190624092322.470688892@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 89c92142f75eb80064f5b9f1111484b1b4d81790 ] | arch/arc/mm/tlb.c:914:2: warning: variable length array 'pd0' is used [-Wvla] | arch/arc/include/asm/cmpxchg.h:95:29: warning: value computed is not used [-Wunused-value] Signed-off-by: Vineet Gupta Signed-off-by: Sasha Levin --- arch/arc/include/asm/cmpxchg.h | 14 ++++++++++---- arch/arc/mm/tlb.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/arch/arc/include/asm/cmpxchg.h b/arch/arc/include/asm/cmpxchg.h index d819de1c5d10..3ea4112c8302 100644 --- a/arch/arc/include/asm/cmpxchg.h +++ b/arch/arc/include/asm/cmpxchg.h @@ -92,8 +92,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new) #endif /* CONFIG_ARC_HAS_LLSC */ -#define cmpxchg(ptr, o, n) ((typeof(*(ptr)))__cmpxchg((ptr), \ - (unsigned long)(o), (unsigned long)(n))) +#define cmpxchg(ptr, o, n) ({ \ + (typeof(*(ptr)))__cmpxchg((ptr), \ + (unsigned long)(o), \ + (unsigned long)(n)); \ +}) /* * atomic_cmpxchg is same as cmpxchg @@ -198,8 +201,11 @@ static inline unsigned long __xchg(unsigned long val, volatile void *ptr, return __xchg_bad_pointer(); } -#define xchg(ptr, with) ((typeof(*(ptr)))__xchg((unsigned long)(with), (ptr), \ - sizeof(*(ptr)))) +#define xchg(ptr, with) ({ \ + (typeof(*(ptr)))__xchg((unsigned long)(with), \ + (ptr), \ + sizeof(*(ptr))); \ +}) #endif /* CONFIG_ARC_PLAT_EZNPS */ diff --git a/arch/arc/mm/tlb.c b/arch/arc/mm/tlb.c index 4097764fea23..fa18c00b0cfd 100644 --- a/arch/arc/mm/tlb.c +++ b/arch/arc/mm/tlb.c @@ -911,9 +911,11 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, struct pt_regs *regs) { struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu; - unsigned int pd0[mmu->ways]; unsigned long flags; - int set; + int set, n_ways = mmu->ways; + + n_ways = min(n_ways, 4); + BUG_ON(mmu->ways > 4); local_irq_save(flags); @@ -921,9 +923,10 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, for (set = 0; set < mmu->sets; set++) { int is_valid, way; + unsigned int pd0[4]; /* read out all the ways of current set */ - for (way = 0, is_valid = 0; way < mmu->ways; way++) { + for (way = 0, is_valid = 0; way < n_ways; way++) { write_aux_reg(ARC_REG_TLBINDEX, SET_WAY_TO_IDX(mmu, set, way)); write_aux_reg(ARC_REG_TLBCOMMAND, TLBRead); @@ -937,14 +940,14 @@ void do_tlb_overlap_fault(unsigned long cause, unsigned long address, continue; /* Scan the set for duplicate ways: needs a nested loop */ - for (way = 0; way < mmu->ways - 1; way++) { + for (way = 0; way < n_ways - 1; way++) { int n; if (!pd0[way]) continue; - for (n = way + 1; n < mmu->ways; n++) { + for (n = way + 1; n < n_ways; n++) { if (pd0[way] != pd0[n]) continue; -- 2.20.1