mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@alien8.de>,
	Hanjun Guo <guohanjun@huawei.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Len Brown <lenb@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI: APEI: Remove redundant assignments in erst_dbg_{ioctl|write}()
Date: Fri, 5 Sep 2025 09:19:32 +0800	[thread overview]
Message-ID: <7c0ea575-7682-4601-8922-49684d929374@linux.alibaba.com> (raw)
In-Reply-To: <20250903224913.242928-2-thorsten.blum@linux.dev>



在 2025/9/4 06:49, Thorsten Blum 写道:
> 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 <thorsten.blum@linux.dev>
> ---
>   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;
>   	}

Hi Thorsten,
Thanks for the patch.

The changes look good to me.

Since this is a code cleanup with no functional changes, could you
please mention "no functional change" or similar wording in the commit
message to make it clear?

With that addressed:
Reviewed-by: Shuai Xue <xueshuai@linux.alibaba.com>

Thanks,
Shuai

  reply	other threads:[~2025-09-05  1:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03 22:49 Thorsten Blum
2025-09-05  1:19 ` Shuai Xue [this message]
2025-09-15 19:22   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c0ea575-7682-4601-8922-49684d929374@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=guohanjun@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rafael@kernel.org \
    --cc=thorsten.blum@linux.dev \
    --cc=tony.luck@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®