Message ID | 20240212025529.1971876-8-samuel.holland@sifive.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp2205046dyd; Sun, 11 Feb 2024 19:00:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFNbtfTFJ2QQcpKwlCBVLyxlUn0FJwh2ipvBArqmkSfHPdowC7zuAgOi/vof1NF4Z7ynoUE X-Received: by 2002:a05:6e02:12c7:b0:363:acc1:5003 with SMTP id i7-20020a056e0212c700b00363acc15003mr8259162ilm.31.1707706814816; Sun, 11 Feb 2024 19:00:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707706814; cv=pass; d=google.com; s=arc-20160816; b=CoZUTfAtiMYGDUB5iR0EewggMeUP+wFusOnkW20gyD/EQpdjItdiYhd00ydyOOjHoR WSF4+cEbRLmOXunbcLJ8ktuUFfcqN+XqDeazuJQ0V8VXqOa3W0s+Wm9L825iELQk74GC btkLWpUT7knBYsypgj08yz54I/AP+5yi4tPRH6Nn/Uu+wASdcTqY1s4oXA/Ynqj0i0jV KnDt3t0IWwvk80eVmNqBQ9DLeeyhs25mrG4CTFAt26xM3JLP2lPBAzNYM5kNk4HF9KZK c5ZdpjrOBv7vnBnbbSbmTAFsryTH4NIHa5SIzwCMiOMSXGtQYY1apbZHVEWH7MpvzKk2 fQWA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ox1XwYN/8KUHgBEQv3P+eTmNJiT79C/wgnmP2bJX61k=; fh=6Nr/YHUofWqpFH30Oh0uZo2/UFEcCKkOeWriYrLDzvk=; b=Qx/0xV9OLm/P6QOLF3eg0ddpFJ+sirB5JzINei8XT9Z5/Oj9oRxgPEHxRsKXN16eTg 1Jv6q676vkvAn9w0D867YiFpKBV+DGxXVVsybNLylHBmERrJ2hLLQ51JUv3MphNmpAiP p1AO7rryfUV7PlYCDBUfkz/QCuT6srZdiQxLZtWQ9EKRYYPGgMz23mZdK+TiVw+eiO7h 9U2ymjOpBh+zv926f7zGCYc3GcY8xaHX3T2NbfaYWh94RPaF90hCkkJgIE73JER1hQym TW8VlcBl5UfteMkWfIQ3tE6OB0M+pLwW9D8HzkjRMuWv9X5ePszOaeXcZ2igX/FJ3bsl /tIA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=jdyyW5hJ; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com X-Forwarded-Encrypted: i=2; AJvYcCXjMOp4sJvZx1v0GoCtlebvTLF8KQxzpMpJcn53b15AZuonp0Q+WszMV7K02R8x8otJhs7nIM9hVwFhy/nDGAhla/acMA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p24-20020a637f58000000b005dc4c1f8c5dsi5840373pgn.579.2024.02.11.19.00.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 19:00:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=jdyyW5hJ; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61081-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8E8D3B22AF2 for <ouuuleilei@gmail.com>; Mon, 12 Feb 2024 02:57:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CDBA111B1; Mon, 12 Feb 2024 02:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="jdyyW5hJ" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2596D107B4 for <linux-kernel@vger.kernel.org>; Mon, 12 Feb 2024 02:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706539; cv=none; b=d0QwOqwc8MHFz31MNzYVfPqqgNScRsHllhHzvuvrLgZepEhVR1K+B5ept3jLqS2IOXXdr+Qszad6WYail9QG4kQCtSEiE6HhWwTPrYo43t2I4NVcRB8BNxWhcwJ+Gm9HGb+PnF/feTOlXDesuU/RpJuV5kSF5zn+msUPdE+vE5I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707706539; c=relaxed/simple; bh=UttEtih3z9yX90IGUQyC21qiA8cAYwBHPSzo6eqGVuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sWG5OWYLI3QFcGFeR/6oCt2sTglsg4srNViO6/kk3a+ws5UAlM2A5eE97ifRbl+9qntb9Wx7co4GsFU7OfkpSECe0LJivjLbPWcnz5LqFi4wMJqIvIkSibZ1uxjXXPn+C+kKRLTrSvjvqb9ai3FbmCjpdvAJhk+YRofsJVxnn4Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=jdyyW5hJ; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d93ddd76adso18932705ad.2 for <linux-kernel@vger.kernel.org>; Sun, 11 Feb 2024 18:55:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1707706537; x=1708311337; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ox1XwYN/8KUHgBEQv3P+eTmNJiT79C/wgnmP2bJX61k=; b=jdyyW5hJtNaKAH3J7syG/qH9SJm1y82cwy/l/Y2OrkSZijS9isSYbqq51rd7dL9DH0 zk0qNHhYTqIp99/FvZKxPyrJvGgg5Bhy9bDCARh67WOf4pSK0R0s4SVsx0ILwSz+Jzxz bg5PA9RTDcp+mAkr4TFok10bwCDIkq0zEUaWdfAc3RaiQNqlpX20or6uVVcZlNbZxcdR CU+xAavVv0/BcMrgBxxirvIu5sCW23STdP8wBu0XwtXEsoR0NY9AbRzxyf+IFsTSAz2U GC67csQb7c8HL/FZNEOAqSyXrvN8c2WbQFRgiKC4JAbcd+3g7nf+Tq0P0CP7ZfTVIHhF vxdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707706537; x=1708311337; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ox1XwYN/8KUHgBEQv3P+eTmNJiT79C/wgnmP2bJX61k=; b=lef/ic9RTsz+vhGDfUKkssBu/LSHx3n+U2pxC+tnqSIp0DPimNz9RXSTGWLW8l/Jd6 /J/8iHFaTAwgvF22wpqPmjE/AxrU62wG/iXfb/pM7LvJXFB6xziRQpS3GkPf6kEOypd4 tf9mvHMC5n4h4O6q6H3j0NsmLh4kyp3kfld7aYGHD1A3LPKTqg5GPY4axkrH+Amga6+Q bfz8gcEMZ8H+KjZWf16DgrqNNqdrRfIt6sVbD5DkrxECC/V7xM+9QwM5m7qDjP60/8Cr M9kgedDJzjAQIYj8NwYxC1Hsj0i7hsvdKr2wIW820fI926kegOF6f/XwHuHamYue3hJF mqgQ== X-Gm-Message-State: AOJu0Yz/WFUEuj7z+sqh8harzDbbdrjSI47MI/SztsCBhcGfZ+Ha74yJ 8Lqs1MEn8NvOYScdBnd/SEoIR/v739IGG5xTekeLBcY+TrIXRPP9OhZEli2uxy8= X-Received: by 2002:a17:902:ec91:b0:1d9:a148:48a with SMTP id x17-20020a170902ec9100b001d9a148048amr6334084plg.24.1707706537479; Sun, 11 Feb 2024 18:55:37 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWSKmmJnT8/3BSU7Qh0RzNAg0qQ1juI97gXPgba5vC2fWKScLl4PX6qPshaybpKTz5/v3owJsCFEwiJlXAtPYFw/embDaV2OphOMNya5Shdc8dllDXVfo1lnQ+DisEUKB9rWLv40/ii Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id lb3-20020a170902fa4300b001d9af77893esm4906443plb.58.2024.02.11.18.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 18:55:37 -0800 (PST) From: Samuel Holland <samuel.holland@sifive.com> To: Palmer Dabbelt <palmer@dabbelt.com> Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Samuel Holland <samuel.holland@sifive.com> Subject: [PATCH 7/7] riscv: Remove extra variable in patch_text_nosync() Date: Sun, 11 Feb 2024 18:55:18 -0800 Message-ID: <20240212025529.1971876-8-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240212025529.1971876-1-samuel.holland@sifive.com> References: <20240212025529.1971876-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790660380945584747 X-GMAIL-MSGID: 1790660380945584747 |
Series |
riscv: Various text patching improvements
|
|
Commit Message
Samuel Holland
Feb. 12, 2024, 2:55 a.m. UTC
This cast is superfluous, and is incorrect anyway if compressed
instructions may be present.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---
arch/riscv/kernel/patch.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
Comments
Samuel Holland <samuel.holland@sifive.com> writes: > This cast is superfluous, and is incorrect anyway if compressed > instructions may be present. > > Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Björn Töpel <bjorn@rivosinc.com>
diff --git a/arch/riscv/kernel/patch.c b/arch/riscv/kernel/patch.c index b0cf050738aa..80755aa627d2 100644 --- a/arch/riscv/kernel/patch.c +++ b/arch/riscv/kernel/patch.c @@ -176,13 +176,11 @@ NOKPROBE_SYMBOL(patch_insn_set); int patch_text_set_nosync(void *addr, u8 c, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_set(tp, c, len); - + ret = patch_insn_set(addr, c, len); if (!ret) - flush_icache_range((uintptr_t)tp, (uintptr_t)tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; } @@ -212,13 +210,11 @@ NOKPROBE_SYMBOL(patch_insn_write); int patch_text_nosync(void *addr, const void *insns, size_t len) { - u32 *tp = addr; int ret; - ret = patch_insn_write(tp, insns, len); - + ret = patch_insn_write(addr, insns, len); if (!ret) - flush_icache_range((uintptr_t) tp, (uintptr_t) tp + len); + flush_icache_range((uintptr_t)addr, (uintptr_t)addr + len); return ret; }