From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3E072D7DE1 for ; Wed, 3 Sep 2025 22:49:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756939792; cv=none; b=fPy+HDQ2gLgVvJQN1UQ5rAezEKRRUM9vZ89II0rWABNae2CxAIy7ikRfJ2swslvrwgxw5RmlIndpxkNUFDnXobg1WVE5cyAWQPZNLUfqFi5612dW6wy+M+c8nFka8RsIATDPYwmbdd0MTX8qJPw2/wywDpuhmBJ9t1KJQhwJ00k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756939792; c=relaxed/simple; bh=5zxZbULTDjBJNqwOYWJcqyxdFdAB7xODm4RLQ8h9b7k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=oap8rYeH/ePAyNuvkxm6ZGhmD0+Fsr1yneXoUiggP/Mbn4FvC4wRB7wk3UnEqYWwxHHQWFHvzJdwdV6OtLlUvqrSJHJqfMmSAcQkTHDpxCOYZZdJBhCA8PjKixTVf7cVNoj7U9yyA10hG82Tu00i5RpRPAbUQha+YdYuSPSwwIc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=OD9JtDHE; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="OD9JtDHE" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1756939787; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=v8J4btAAPddn3JaQV4f8n+Z/XZPSOT+Xr10bO/NP8/o=; b=OD9JtDHENpogOeIIYgpnD4Q8s4HpIxtkZbL7K5q9riCkemeP5c98YpOkTYFANTE7BnOIcu 3FhYMSoRIurNI9mNF3f1qh4Tsn1LykHnJsFkggG+hZx5h4DuFTd3i3BAp7e6AvYhq99rzW QsrqGCIUEPtS3rGT4aO0+QYUa+VVKIY= From: Thorsten Blum To: "Rafael J. Wysocki" , Tony Luck , Borislav Petkov , Hanjun Guo , Mauro Carvalho Chehab , Shuai Xue , Len Brown , Al Viro Cc: Thorsten Blum , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}() Date: Thu, 4 Sep 2025 00:49:11 +0200 Message-ID: <20250903224913.242928-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Use the result of copy_from_user() directly instead of assigning it to the local variable 'rc' and then overwriting it in erst_dbg_write() or immediately returning from erst_dbg_ioctl(). Signed-off-by: Thorsten Blum --- drivers/acpi/apei/erst-dbg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/apei/erst-dbg.c b/drivers/acpi/apei/erst-dbg.c index 246076341e8c..ff0e8bf8e97a 100644 --- a/drivers/acpi/apei/erst-dbg.c +++ b/drivers/acpi/apei/erst-dbg.c @@ -60,9 +60,8 @@ static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg) switch (cmd) { case APEI_ERST_CLEAR_RECORD: - rc = copy_from_user(&record_id, (void __user *)arg, - sizeof(record_id)); - if (rc) + if (copy_from_user(&record_id, (void __user *)arg, + sizeof(record_id))) return -EFAULT; return erst_clear(record_id); case APEI_ERST_GET_RECORD_COUNT: @@ -175,8 +174,7 @@ static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf, erst_dbg_buf = p; erst_dbg_buf_len = usize; } - rc = copy_from_user(erst_dbg_buf, ubuf, usize); - if (rc) { + if (copy_from_user(erst_dbg_buf, ubuf, usize)) { rc = -EFAULT; goto out; } -- 2.51.0