Thanks.I will make a 2nd patch.

Doug Anderson <diand...@chromium.org> 于2021年1月26日周二 上午1:56写道:

> Hi,
>
> On Sat, Jan 23, 2021 at 3:14 AM Stephen Zhang <stephenzhang...@gmail.com>
> wrote:
> >
> > Better to replace function name by %s in case of changes.
> >
> > Signed-off-by: Stephen Zhang <stephenzhang...@gmail.com>
> > ---
> >  kernel/debug/kdb/kdb_support.c | 32 ++++++++++++++++----------------
> >  1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/kernel/debug/kdb/kdb_support.c
> b/kernel/debug/kdb/kdb_support.c
> > index 6226502..7a536fc 100644
> > --- a/kernel/debug/kdb/kdb_support.c
> > +++ b/kernel/debug/kdb/kdb_support.c
> > @@ -40,19 +40,19 @@
> >  int kdbgetsymval(const char *symname, kdb_symtab_t *symtab)
> >  {
> >         if (KDB_DEBUG(AR))
> > -               kdb_printf("kdbgetsymval: symname=%s, symtab=%px\n",
> symname,
> > +               kdb_printf("%s: symname=%s, symtab=%px\n", __func__,
> symname,
>
> Given the common pattern:
>
> if (KDB_DEBUG(AR))
>   kdb_printf(...)
>
> I wonder if we could improve this to this (untested):
>
> #define kdb_ardbg_printf(format, ...) \
>   do { \
>     if (KDB_DEBUG(AR)) \
>       kdb_printf("%s: " format, __func__, __VA_ARGS__); \
>   } while (0)
>
> Then the above just becomes:
>
> kdb_ardbg_printf("symname=%s, symtab=%px\n", symname,
>
>
> > @@ -435,7 +435,7 @@ int kdb_getphysword(unsigned long *word, unsigned
> long addr, size_t size)
> >                 fallthrough;
> >         default:
> >                 diag = KDB_BADWIDTH;
> > -               kdb_printf("kdb_getphysword: bad width %ld\n", (long)
> size);
> > +               kdb_printf("%s: bad width %ld\n", __func__, (long) size);
>
> Unrelated to your patch, but if you want a 2nd patch you could fix it
> to not cast "size" to a long and use the proper format code for a
> size_t (%zu)
>
>
> > @@ -484,7 +484,7 @@ int kdb_getword(unsigned long *word, unsigned long
> addr, size_t size)
> >                 fallthrough;
> >         default:
> >                 diag = KDB_BADWIDTH;
> > -               kdb_printf("kdb_getword: bad width %ld\n", (long) size);
> > +               kdb_printf("%s: bad width %ld\n", __func__, (long) size);
>
> This also could get the correct format code.
>
>
> > @@ -528,7 +528,7 @@ int kdb_putword(unsigned long addr, unsigned long
> word, size_t size)
> >                 fallthrough;
> >         default:
> >                 diag = KDB_BADWIDTH;
> > -               kdb_printf("kdb_putword: bad width %ld\n", (long) size);
> > +               kdb_printf("%s: bad width %ld\n", __func__, (long) size);
>
> ...and this.
>
> In any case, all my comments are nits and/or things that should happen
> in a 2nd and your patch improves things.  Thus:
>
> Reviewed-by: Douglas Anderson <diand...@chromium.org>
>

_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to