Re: [PATCH] printk-formats.txt: Add examples for %pS and %pF

From: Steven Rostedt
Date: Tue Aug 15 2017 - 17:36:01 EST


On Tue, 15 Aug 2017 21:47:27 +0200
Helge Deller <deller@xxxxxx> wrote:

> > Very interesting!
> >
> > This code:
> > void smp_cpus_done() {
> > printk("Called from %pF.\n", smp_cpus_done);
> > printk("Called from %pf.\n", smp_cpus_done);
> > printk("Called in %pS.\n", __func__);
> > printk("Called in %ps.\n", __func__);
> > printk("Called in %pF.\n", __func__);
> > printk("Called in %pf.\n", __func__);
> >
> > gives:
> > Called from smp_cpus_done+0x0/0x1b8.
> > Called from smp_cpus_done.
> > Called in __func__.28197+0x0/0x20.
> > Called in __func__.28197.
> > Called in 0x5041524953433332.
> > Called in 0x5041524953433332.
> >
> > So, the correct usage is:
> > printk("Called in %pS.\n", __func__);
>
> I'm wrong.
> The correct usage would be:
> printk("Called in %s.\n", __func__);
>
> __func__ is just a pointer to a string.

OK, I'm still on vacation :-/

Yeah, I was looking for usages of %pF, and came across this:

pr_warn("%s: NULL omap_sr from %pF\n",
__func__, (void *)_RET_IP_);

And not noticing the first "%s" :-p

-- Steve