]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 3 Sep 2025 22:49:11 +0000 (00:49 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 15 Sep 2025 19:21:57 +0000 (21:21 +0200)
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>
drivers/acpi/apei/erst-dbg.c

index 246076341e8cc065a8efda7d60cb66c55438e85c..ff0e8bf8e97ac84e2d01a7367aa516f832fc3342 100644 (file)
@@ -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;
        }