public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
@ 2017-06-23  9:00 Colin King
  2017-06-23 10:02 ` Rafał Miłecki
  0 siblings, 1 reply; 6+ messages in thread
From: Colin King @ 2017-06-23  9:00 UTC (permalink / raw)
  To: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, Cyrille Pitchen, Rafał Miłecki,
	linux-mtd
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Use %zx instead of %X for size_t variable offset, fixes build warning:

warning: format '%X' expects argument of type 'unsigned int', but argument
2 has type 'size_t {aka long unsigned int}' [-Wformat=]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/mtd/parsers/parser_trx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/parsers/parser_trx.c b/drivers/mtd/parsers/parser_trx.c
index e805108afd31..c0539555fac3 100644
--- a/drivers/mtd/parsers/parser_trx.c
+++ b/drivers/mtd/parsers/parser_trx.c
@@ -39,7 +39,7 @@ static const char *parser_trx_data_part_name(struct mtd_info *master,
 	err  = mtd_read(master, offset, sizeof(buf), &bytes_read,
 			(uint8_t *)&buf);
 	if (err && !mtd_is_bitflip(err)) {
-		pr_err("mtd_read error while parsing (offset: 0x%X): %d\n",
+		pr_err("mtd_read error while parsing (offset: 0x%zx): %d\n",
 			offset, err);
 		goto out_default;
 	}
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
  2017-06-23  9:00 [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier Colin King
@ 2017-06-23 10:02 ` Rafał Miłecki
  2017-06-23 17:51   ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Rafał Miłecki @ 2017-06-23 10:02 UTC (permalink / raw)
  To: Colin King
  Cc: David Woodhouse, Brian Norris, Boris Brezillon, Marek Vasut,
	Richard Weinberger, Cyrille Pitchen, linux-mtd, kernel-janitors,
	linux-kernel

On 2017-06-23 11:00, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Use %zx instead of %X for size_t variable offset, fixes build warning:
> 
> warning: format '%X' expects argument of type 'unsigned int', but 
> argument
> 2 has type 'size_t {aka long unsigned int}' [-Wformat=]
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

I sent similar patch few hours earlier:
[PATCH] mtd: parsers: trx: fix pr_err format for printing offset
https://patchwork.ozlabs.org/patch/779789/

Brian: you may pick the one with nicer commit message, whichever one you
prefer :)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
  2017-06-23 10:02 ` Rafał Miłecki
@ 2017-06-23 17:51   ` Brian Norris
  2017-06-23 18:03     ` Colin Ian King
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2017-06-23 17:51 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Colin King, David Woodhouse, Boris Brezillon, Marek Vasut,
	Richard Weinberger, Cyrille Pitchen, linux-mtd, kernel-janitors,
	linux-kernel

On Fri, Jun 23, 2017 at 12:02:34PM +0200, Rafał Miłecki wrote:
> On 2017-06-23 11:00, Colin King wrote:
> >From: Colin Ian King <colin.king@canonical.com>
> >
> >Use %zx instead of %X for size_t variable offset, fixes build warning:
> >
> >warning: format '%X' expects argument of type 'unsigned int', but
> >argument
> >2 has type 'size_t {aka long unsigned int}' [-Wformat=]
> >
> >Signed-off-by: Colin Ian King <colin.king@canonical.com>
> 
> I sent similar patch few hours earlier:
> [PATCH] mtd: parsers: trx: fix pr_err format for printing offset
> https://patchwork.ozlabs.org/patch/779789/
> 
> Brian: you may pick the one with nicer commit message, whichever one you
> prefer :)

I'll go with:
(a) the earlier one and
(b) the one that doesn't change 'X' to 'x'

That means Rafał, you're our lucky winner today! Thanks for playing,
Colin.

Regards,
Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
  2017-06-23 17:51   ` Brian Norris
@ 2017-06-23 18:03     ` Colin Ian King
  2017-06-23 18:15       ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Colin Ian King @ 2017-06-23 18:03 UTC (permalink / raw)
  To: Brian Norris, Rafał Miłecki
  Cc: David Woodhouse, Boris Brezillon, Marek Vasut, Richard Weinberger,
	Cyrille Pitchen, linux-mtd, kernel-janitors, linux-kernel

On 23/06/17 18:51, Brian Norris wrote:
> On Fri, Jun 23, 2017 at 12:02:34PM +0200, Rafał Miłecki wrote:
>> On 2017-06-23 11:00, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> Use %zx instead of %X for size_t variable offset, fixes build warning:
>>>
>>> warning: format '%X' expects argument of type 'unsigned int', but
>>> argument
>>> 2 has type 'size_t {aka long unsigned int}' [-Wformat=]
>>>
>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>
>> I sent similar patch few hours earlier:
>> [PATCH] mtd: parsers: trx: fix pr_err format for printing offset
>> https://patchwork.ozlabs.org/patch/779789/
>>
>> Brian: you may pick the one with nicer commit message, whichever one you
>> prefer :)
> 
> I'll go with:
> (a) the earlier one and
> (b) the one that doesn't change 'X' to 'x'
> 
> That means Rafał, you're our lucky winner today! Thanks for playing,
> Colin.

FYI, I used %zx rather than %zX as couldn't find any instances of it in
the kernel and I wasn't 100% sure if it was supported or not.

linux-next:

$ git grep "%zx" | wc -l
161

$ git grep "%zX" | wc -l
0

Colin

> 
> Regards,
> Brian
> --
> 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] 6+ messages in thread

* Re: [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
  2017-06-23 18:03     ` Colin Ian King
@ 2017-06-23 18:15       ` Brian Norris
  2017-06-23 18:21         ` Colin Ian King
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2017-06-23 18:15 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Rafał Miłecki, David Woodhouse, Boris Brezillon,
	Marek Vasut, Richard Weinberger, Cyrille Pitchen, linux-mtd,
	kernel-janitors, linux-kernel

On Fri, Jun 23, 2017 at 07:03:11PM +0100, Colin Ian King wrote:
> On 23/06/17 18:51, Brian Norris wrote:
> > On Fri, Jun 23, 2017 at 12:02:34PM +0200, Rafał Miłecki wrote:
> >> On 2017-06-23 11:00, Colin King wrote:
> >>> From: Colin Ian King <colin.king@canonical.com>
> >>>
> >>> Use %zx instead of %X for size_t variable offset, fixes build warning:
> >>>
> >>> warning: format '%X' expects argument of type 'unsigned int', but
> >>> argument
> >>> 2 has type 'size_t {aka long unsigned int}' [-Wformat=]
> >>>
> >>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> >>
> >> I sent similar patch few hours earlier:
> >> [PATCH] mtd: parsers: trx: fix pr_err format for printing offset
> >> https://patchwork.ozlabs.org/patch/779789/
> >>
> >> Brian: you may pick the one with nicer commit message, whichever one you
> >> prefer :)
> > 
> > I'll go with:
> > (a) the earlier one and
> > (b) the one that doesn't change 'X' to 'x'
> > 
> > That means Rafał, you're our lucky winner today! Thanks for playing,
> > Colin.
> 
> FYI, I used %zx rather than %zX as couldn't find any instances of it in
> the kernel and I wasn't 100% sure if it was supported or not.

'x' and 'X' are handled nearly identically in lib/vsprintf.c. Don't see
why it wouldn't be.

> linux-next:
> 
> $ git grep "%zx" | wc -l
> 161
> 
> $ git grep "%zX" | wc -l
> 0

Yay, we're unique!

Seriously though: I don't really care which one is used (though I guess
I'm personally more used to lower-case hex). I just figured the less
churn the better.

Brian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier
  2017-06-23 18:15       ` Brian Norris
@ 2017-06-23 18:21         ` Colin Ian King
  0 siblings, 0 replies; 6+ messages in thread
From: Colin Ian King @ 2017-06-23 18:21 UTC (permalink / raw)
  To: Brian Norris
  Cc: Rafał Miłecki, David Woodhouse, Boris Brezillon,
	Marek Vasut, Richard Weinberger, Cyrille Pitchen, linux-mtd,
	kernel-janitors, linux-kernel

On 23/06/17 19:15, Brian Norris wrote:
> On Fri, Jun 23, 2017 at 07:03:11PM +0100, Colin Ian King wrote:
>> On 23/06/17 18:51, Brian Norris wrote:
>>> On Fri, Jun 23, 2017 at 12:02:34PM +0200, Rafał Miłecki wrote:
>>>> On 2017-06-23 11:00, Colin King wrote:
>>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>>
>>>>> Use %zx instead of %X for size_t variable offset, fixes build warning:
>>>>>
>>>>> warning: format '%X' expects argument of type 'unsigned int', but
>>>>> argument
>>>>> 2 has type 'size_t {aka long unsigned int}' [-Wformat=]
>>>>>
>>>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> I sent similar patch few hours earlier:
>>>> [PATCH] mtd: parsers: trx: fix pr_err format for printing offset
>>>> https://patchwork.ozlabs.org/patch/779789/
>>>>
>>>> Brian: you may pick the one with nicer commit message, whichever one you
>>>> prefer :)
>>>
>>> I'll go with:
>>> (a) the earlier one and
>>> (b) the one that doesn't change 'X' to 'x'
>>>
>>> That means Rafał, you're our lucky winner today! Thanks for playing,
>>> Colin.
>>
>> FYI, I used %zx rather than %zX as couldn't find any instances of it in
>> the kernel and I wasn't 100% sure if it was supported or not.
> 
> 'x' and 'X' are handled nearly identically in lib/vsprintf.c. Don't see
> why it wouldn't be.
> 
>> linux-next:
>>
>> $ git grep "%zx" | wc -l
>> 161
>>
>> $ git grep "%zX" | wc -l
>> 0
> 
> Yay, we're unique!
> 
> Seriously though: I don't really care which one is used (though I guess
> I'm personally more used to lower-case hex). I just figured the less
> churn the better.

That's fine by me too.
> 
> Brian
> --
> 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] 6+ messages in thread

end of thread, other threads:[~2017-06-23 18:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-23  9:00 [PATCH][mtd-next] mtd: parser: print hex size_t value using correct %zx printk format specifier Colin King
2017-06-23 10:02 ` Rafał Miłecki
2017-06-23 17:51   ` Brian Norris
2017-06-23 18:03     ` Colin Ian King
2017-06-23 18:15       ` Brian Norris
2017-06-23 18:21         ` 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