[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFA6WYM0=WaFd7uUYaTje+22oVmG1fCBOYAz8UUmB2z6qcK=6g@mail.gmail.com>
Date: Wed, 3 Jun 2020 10:16:53 +0530
From: Sumit Garg <sumit.garg@...aro.org>
To: Doug Anderson <dianders@...omium.org>
Cc: Daniel Thompson <daniel.thompson@...aro.org>,
kgdb-bugreport@...ts.sourceforge.net,
Jason Wessel <jason.wessel@...driver.com>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 1/4] kdb: Re-factor kdb_printf() message write code
On Wed, 3 Jun 2020 at 03:02, Doug Anderson <dianders@...omium.org> wrote:
>
> Hi,
>
> On Fri, May 29, 2020 at 4:27 AM Sumit Garg <sumit.garg@...aro.org> wrote:
> >
> > Re-factor kdb_printf() message write code in order to avoid duplication
> > of code and thereby increase readability.
> >
> > Signed-off-by: Sumit Garg <sumit.garg@...aro.org>
> > ---
> > kernel/debug/kdb/kdb_io.c | 61 +++++++++++++++++++++++++----------------------
> > 1 file changed, 32 insertions(+), 29 deletions(-)
> >
> > diff --git a/kernel/debug/kdb/kdb_io.c b/kernel/debug/kdb/kdb_io.c
> > index 924bc92..e46f33e 100644
> > --- a/kernel/debug/kdb/kdb_io.c
> > +++ b/kernel/debug/kdb/kdb_io.c
> > @@ -542,6 +542,33 @@ static int kdb_search_string(char *searched, char *searchfor)
> > return 0;
> > }
> >
> > +static void kdb_io_write(char *cp, int len)
>
> nit: "const char *" just to make it obvious that we don't modify the string?
>
>
> > +{
> > + if (len == 0)
> > + return;
>
> Remove the above check. It's double-overkill. Not only did you just
> check in kdb_msg_write() but also the while loop below will do a
> "no-op" just fine even without your check.
>
I will get rid of kdb_io_write() as per Daniel's comment on patch #4.
>
> > +
> > + while (len--) {
> > + dbg_io_ops->write_char(*cp);
> > + cp++;
> > + }
> > +}
> > +
> > +static void kdb_msg_write(char *msg, int msg_len)
>
> nit: "const char *" just to make it obvious that we don't modify the string?
>
Okay.
>
> Other than those small things, this looks nice to me. Feel free to
> add my Reviewed-by tag once small things are fixed.
>
Thanks.
-Sumit
>
> -Doug
Powered by blists - more mailing lists