Skip to content

Commit e06722a

Browse files
tobluxrafaeljw
authored andcommitted
ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()
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(). No intentional functional changes. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com> Link: https://patch.msgid.link/20250903224913.242928-2-thorsten.blum@linux.dev [ rjw: Changelog edit ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f83ec76 commit e06722a

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/acpi/apei/erst-dbg.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
6060

6161
switch (cmd) {
6262
case APEI_ERST_CLEAR_RECORD:
63-
rc = copy_from_user(&record_id, (void __user *)arg,
64-
sizeof(record_id));
65-
if (rc)
63+
if (copy_from_user(&record_id, (void __user *)arg,
64+
sizeof(record_id)))
6665
return -EFAULT;
6766
return erst_clear(record_id);
6867
case APEI_ERST_GET_RECORD_COUNT:
@@ -175,8 +174,7 @@ static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf,
175174
erst_dbg_buf = p;
176175
erst_dbg_buf_len = usize;
177176
}
178-
rc = copy_from_user(erst_dbg_buf, ubuf, usize);
179-
if (rc) {
177+
if (copy_from_user(erst_dbg_buf, ubuf, usize)) {
180178
rc = -EFAULT;
181179
goto out;
182180
}

0 commit comments

Comments
 (0)