LKML Archive mirror
 help / color / mirror / Atom feed
From: Russ Weight <russ.weight@linux.dev>
To: Haoyang Liu <tttturtleruss@hust.edu.cn>
Cc: Luis Chamberlain <mcgrof@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	hust-os-kernel-patches@googlegroups.com,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware_loader: Replace simple_strtol() with kstrtoint()
Date: Mon, 29 Apr 2024 13:50:31 -0700	[thread overview]
Message-ID: <20240429205031.27tpfij7mlrt3a46@4VRSMR2-DT.corp.robot.car> (raw)
In-Reply-To: <20240426202532.27848-1-tttturtleruss@hust.edu.cn>

On Sat, Apr 27, 2024 at 04:25:32AM +0800, Haoyang Liu wrote:
> simple_strtol() is obsolete, use kstrtoint() instead.
> 
> Signed-off-by: Haoyang Liu <tttturtleruss@hust.edu.cn>
> Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

Reviewed-by: Russ Weight <russ.weight@linux.dev>

> ---
>  drivers/base/firmware_loader/sysfs.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/base/firmware_loader/sysfs.c b/drivers/base/firmware_loader/sysfs.c
> index c9c93b47d9a5..4de1cb243bee 100644
> --- a/drivers/base/firmware_loader/sysfs.c
> +++ b/drivers/base/firmware_loader/sysfs.c
> @@ -47,8 +47,12 @@ static ssize_t timeout_show(const struct class *class, const struct class_attrib
>  static ssize_t timeout_store(const struct class *class, const struct class_attribute *attr,
>  			     const char *buf, size_t count)
>  {
> -	int tmp_loading_timeout = simple_strtol(buf, NULL, 10);
> +	int tmp_loading_timeout;
> +	int res;
>  
> +	res = kstrtoint(buf, 10, &tmp_loading_timeout);
> +	if (res < 0)
> +		return res;
>  	if (tmp_loading_timeout < 0)
>  		tmp_loading_timeout = 0;
>  
> @@ -157,8 +161,12 @@ static ssize_t firmware_loading_store(struct device *dev,
>  	struct fw_sysfs *fw_sysfs = to_fw_sysfs(dev);
>  	struct fw_priv *fw_priv;
>  	ssize_t written = count;
> -	int loading = simple_strtol(buf, NULL, 10);
> +	int loading;
> +	int res;
>  
> +	res = kstrtoint(buf, 10, &loading);
> +	if (res < 0)
> +		return res;
>  	mutex_lock(&fw_lock);
>  	fw_priv = fw_sysfs->fw_priv;
>  	if (fw_state_is_aborted(fw_priv) || fw_state_is_done(fw_priv))
> -- 
> 2.25.1
> 

  reply	other threads:[~2024-04-29 20:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 20:25 [PATCH] firmware_loader: Replace simple_strtol() with kstrtoint() Haoyang Liu
2024-04-29 20:50 ` Russ Weight [this message]
2024-05-04 18:22 ` Andy Shevchenko
2024-05-05  6:35   ` Greg Kroah-Hartman

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=20240429205031.27tpfij7mlrt3a46@4VRSMR2-DT.corp.robot.car \
    --to=russ.weight@linux.dev \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hust-os-kernel-patches@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=rafael@kernel.org \
    --cc=tttturtleruss@hust.edu.cn \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).