Re: [PATCH 2/2] serial: ma35d1: Improve logging for out-of-bound console setup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hugo,

> Andi Shyti <andi.shyti@xxxxxxxxxx> wrote:
> > An out-of-bound index results in an error and should not be
> > logged merely as a debug message; it requires at least a warning
> > level. Therefore, use pr_warn() instead of pr_debug.
> > 
> > Additionally, the log message itself has been improved for
> > clarity.
> > 
> > Signed-off-by: Andi Shyti <andi.shyti@xxxxxxxxxx>
> > Cc: Jacky Huang <ychuang3@xxxxxxxxxxx>
> > ---
> >  drivers/tty/serial/ma35d1_serial.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/tty/serial/ma35d1_serial.c b/drivers/tty/serial/ma35d1_serial.c
> > index 21b574f78b861..bcc402b4c0b2f 100644
> > --- a/drivers/tty/serial/ma35d1_serial.c
> > +++ b/drivers/tty/serial/ma35d1_serial.c
> > @@ -599,7 +599,8 @@ static int __init ma35d1serial_console_setup(struct console *co, char *options)
> >  	int flow = 'n';
> >  
> >  	if ((co->index < 0) || (co->index >= MA35_UART_NR)) {
> > -		pr_debug("Console Port%x out of range\n", co->index);
> > +		pr_warn("Failed to write on cononsole port %x, out of range\n",
> > +			co->index);
> 
> Hi,
> I do not see why this improves clarity...

I came here from the previous patch (which, by the way, needs a
little change) as I noticed that the same check was being
performed elsewhere, but with a different message. I decided I
prefer my version more because if the id is 18, 'Console Port18
out of range' doesn’t mean much to me, and I don't know what the
driver is trying to do.

Another improvement to the message would be to print out the
failing function.

Of course, I can live without changing the message.

> 
> You also introduced a syntax error "cononsole".

that's unwanted, thanks.

Andi

> Hugo.
> 
> 
> >  		return -EINVAL;
> >  	}
> >  
> > -- 
> > 2.43.0
> > 
> > 
> 
> 
> -- 
> Hugo Villeneuve




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux