Re: [PATCH v1] ipmi: use %*ph to print small buffer

From: Andy Shevchenko
Date: Fri Oct 11 2019 - 11:36:42 EST


On Fri, Oct 11, 2019 at 08:18:41AM -0700, Joe Perches wrote:
> On Fri, 2019-10-11 at 18:12 +0300, Andy Shevchenko wrote:
> > On Fri, Oct 11, 2019 at 07:58:14AM -0700, Joe Perches wrote:
> > > On Fri, 2019-10-11 at 17:52 +0300, Andy Shevchenko wrote:

> > > > static void ipmi_debug_msg(const char *title, unsigned char *data,
...
> > > > + pr_debug("%s: %*ph\n", title, len, buf);
...
> > > > #else
> > > > static void ipmi_debug_msg(const char *title, unsigned char *data,

> > > Now you might as well remove the #ifdef DEBUG above this
> > > and the empty function in the #else too.
> >
> > It's up to maintainer.
>
> That's like suggesting any function with a single pr_debug
> should have another duplicative empty function without.
>
> Using code like the below is not good form as it's prone
> to defects when the arguments in one block is changed but
> not the other.
>
> Also the first form doesn't work with dynamic debug.

I'm surprised to see my name in To:. I guess you intended to explain this to
Corey. I'm fine with either, since I have no idea what is in the IPMI going on.

--
With Best Regards,
Andy Shevchenko