Re: n_gsm: clean up printks

From: Geert Uytterhoeven
Date: Sun Mar 20 2011 - 05:56:16 EST


On Fri, Jan 7, 2011 at 23:59, Linux Kernel Mailing List
<linux-kernel@xxxxxxxxxxxxxxx> wrote:
> Gitweb: Â Â http://git.kernel.org/linus/5f9a31d63105c3e88bd6d026e7bc53f02a5ac042
> Commit: Â Â 5f9a31d63105c3e88bd6d026e7bc53f02a5ac042
> Parent: Â Â c2f2f0000bb69f067fea12624272e6a58a811702
> Author: Â Â Alan Cox <alan@xxxxxxxxxxxxxxx>
> AuthorDate: Thu Nov 4 15:17:27 2010 +0000
> Committer: ÂGreg Kroah-Hartman <gregkh@xxxxxxx>
> CommitDate: Thu Nov 11 11:35:58 2010 -0800
>
> Â Ân_gsm: clean up printks
>
> Â Â[Original From Ken Mills but I redid it using pr_ helpers instead]

> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
> index 5256087..11a25fa 100644
> --- a/drivers/tty/n_gsm.c
> +++ b/drivers/tty/n_gsm.c

> @@ -526,11 +530,13 @@ static void hex_packet(const unsigned char *p, int len)
> Â{
> Â Â Â Âint i;
> Â Â Â Âfor (i = 0; i < len; i++) {
> - Â Â Â Â Â Â Â if (i && (i % 16) == 0)
> - Â Â Â Â Â Â Â Â Â Â Â printk("\n");
> - Â Â Â Â Â Â Â printk("%02X ", *p++);
> + Â Â Â Â Â Â Â if (i && (i % 16) == 0) {
> + Â Â Â Â Â Â Â Â Â Â Â pr_cont("\n");
> + Â Â Â Â Â Â Â Â Â Â Â pr_debug("");

drivers/tty/n_gsm.c: In function âhex_packetâ:
drivers/tty/n_gsm.c:535: warning: zero-length printf format string

Originally reported by Randy
http://linux.derkeiler.com/Mailing-Lists/Kernel/2011-02/msg04880.html

There's no way this is going to be printed nicely. Please use
print_hex_dump() instead.

> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â pr_cont("%02X ", *p++);
> Â Â Â Â}
> - Â Â Â printk("\n");
> + Â Â Â pr_cont("\n");
> Â}

Gr{oetje,eeting}s,

            Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
             Â Â -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/