Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1569671
| From | walter harms <wharms@bfs.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints |
| Date | 2017-01-30 13:10 +0100 |
| Message-ID | <t5iWu-3Pv-25@gated-at.bofh.it> (permalink) |
| References | <t5ijL-3mW-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] acpi: nfit: use %u format string specifier for unsigned ints Colin King <colin.king@canonical.com> - 2017-01-30 12:30 +0100
Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints walter harms <wharms@bfs.de> - 2017-01-30 13:10 +0100
Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints Colin Ian King <colin.king@canonical.com> - 2017-01-30 14:20 +0100
csiph-web