All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	joeyli.kernel@gmail.com, Toshi Kani <toshi.kani@hpe.com>,
	linux-acpi@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints
Date: Mon, 30 Jan 2017 11:58:55 +0000	[thread overview]
Message-ID: <588F2A7F.8020501@bfs.de> (raw)
In-Reply-To: <20170130112502.24426-1-colin.king@canonical.com>



Am 30.01.2017 12:25, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> scrub_mode and scrub_count are both unsigned ints, however, the %d
> format string specifier is being used instead of %u. Trivial fix,
> use %u.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/acpi/nfit/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 2f82b8e..093b768 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -906,7 +906,7 @@ static ssize_t hw_error_scrub_show(struct device *dev,
>  	struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
>  	struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
>  
> -	return sprintf(buf, "%d\n", acpi_desc->scrub_mode);
> +	return sprintf(buf, "%u\n", acpi_desc->scrub_mode);
>  }
>  
>  /*
> @@ -967,7 +967,7 @@ static ssize_t scrub_show(struct device *dev,
>  	if (nd_desc) {
>  		struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
>  
> -		rc = sprintf(buf, "%d%s", acpi_desc->scrub_count,
> +		rc = sprintf(buf, "%u%s", acpi_desc->scrub_count,
>  				(work_busy(&acpi_desc->work)) ? "+\n" : "\n");
>  	}
>  	device_unlock(dev);

looks ok,
would it be an option to move the "\n" into the format string ?
this is much more common (see sprintf() above).

re,
 wh



WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	joeyli.kernel@gmail.com, Toshi Kani <toshi.kani@hpe.com>,
	linux-acpi@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints
Date: Mon, 30 Jan 2017 12:58:55 +0100	[thread overview]
Message-ID: <588F2A7F.8020501@bfs.de> (raw)
In-Reply-To: <20170130112502.24426-1-colin.king@canonical.com>



Am 30.01.2017 12:25, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
> 
> scrub_mode and scrub_count are both unsigned ints, however, the %d
> format string specifier is being used instead of %u. Trivial fix,
> use %u.
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/acpi/nfit/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
> index 2f82b8e..093b768 100644
> --- a/drivers/acpi/nfit/core.c
> +++ b/drivers/acpi/nfit/core.c
> @@ -906,7 +906,7 @@ static ssize_t hw_error_scrub_show(struct device *dev,
>  	struct nvdimm_bus_descriptor *nd_desc = to_nd_desc(nvdimm_bus);
>  	struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
>  
> -	return sprintf(buf, "%d\n", acpi_desc->scrub_mode);
> +	return sprintf(buf, "%u\n", acpi_desc->scrub_mode);
>  }
>  
>  /*
> @@ -967,7 +967,7 @@ static ssize_t scrub_show(struct device *dev,
>  	if (nd_desc) {
>  		struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
>  
> -		rc = sprintf(buf, "%d%s", acpi_desc->scrub_count,
> +		rc = sprintf(buf, "%u%s", acpi_desc->scrub_count,
>  				(work_busy(&acpi_desc->work)) ? "+\n" : "\n");
>  	}
>  	device_unlock(dev);

looks ok,
would it be an option to move the "\n" into the format string ?
this is much more common (see sprintf() above).

re,
 wh



  reply	other threads:[~2017-01-30 11:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 11:25 [PATCH] acpi: nfit: use %u format string specifier for unsigned ints Colin King
2017-01-30 11:58 ` walter harms [this message]
2017-01-30 11:58   ` walter harms
2017-01-30 12:01   ` Colin Ian King

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=588F2A7F.8020501@bfs.de \
    --to=wharms@bfs.de \
    --cc=colin.king@canonical.com \
    --cc=dan.j.williams@intel.com \
    --cc=joeyli.kernel@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=toshi.kani@hpe.com \
    --cc=vishal.l.verma@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.