* [PATCH] acpi: nfit: use %u format string specifier for unsigned ints
@ 2017-01-30 11:25 Colin King
2017-01-30 11:58 ` walter harms
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-01-30 11:25 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown, Dan Williams, Vishal Verma,
joeyli.kernel, Toshi Kani, linux-acpi
Cc: kernel-janitors, linux-kernel
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);
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints
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
2017-01-30 12:01 ` Colin Ian King
0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2017-01-30 11:58 UTC (permalink / raw)
To: Colin King
Cc: Rafael J . Wysocki, Len Brown, Dan Williams, Vishal Verma,
joeyli.kernel, Toshi Kani, linux-acpi, kernel-janitors,
linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] acpi: nfit: use %u format string specifier for unsigned ints
2017-01-30 11:58 ` walter harms
@ 2017-01-30 12:01 ` Colin Ian King
0 siblings, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2017-01-30 12:01 UTC (permalink / raw)
To: wharms
Cc: Rafael J . Wysocki, Len Brown, Dan Williams, Vishal Verma,
joeyli.kernel, Toshi Kani, linux-acpi, kernel-janitors,
linux-kernel
On 30/01/17 11:58, walter harms wrote:
>
>
> 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).
yep, "%u%s\n" - I'll resend
>
> re,
> wh
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-30 13:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-01-30 12:01 ` Colin Ian King
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 NNTP newsgroup(s).