All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Keyur Patel <iamkeyur96@gmail.com>
Cc: devel@driverdev.osuosl.org, Alex Elder <elder@kernel.org>,
	Johan Hovold <johan@kernel.org>,
	linux-kernel@vger.kernel.org, greybus-dev@lists.linaro.org,
	David Lin <dtwlin@gmail.com>
Subject: Re: [PATCH] staging: greybus: add logging statement when kfifo_alloc fails
Date: Thu, 11 Jul 2019 09:00:42 +0200	[thread overview]
Message-ID: <20190711070042.GA28487@kroah.com> (raw)
In-Reply-To: <20190710142406.GA6669@keyur-pc>

On Wed, Jul 10, 2019 at 10:24:06AM -0400, Keyur Patel wrote:
> On Wed, Jul 10, 2019 at 06:35:38PM +0200, Greg Kroah-Hartman wrote:
> > On Wed, Jul 10, 2019 at 08:20:17AM -0400, Keyur Patel wrote:
> > > Added missing logging statement when kfifo_alloc fails, to improve
> > > debugging.
> > > 
> > > Signed-off-by: Keyur Patel <iamkeyur96@gmail.com>
> > > ---
> > >  drivers/staging/greybus/uart.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
> > > index b3bffe91ae99..86a395ae177d 100644
> > > --- a/drivers/staging/greybus/uart.c
> > > +++ b/drivers/staging/greybus/uart.c
> > > @@ -856,8 +856,10 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev,
> > >  
> > >  	retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE,
> > >  			     GFP_KERNEL);
> > > -	if (retval)
> > > +	if (retval) {
> > > +		pr_err("kfifo_alloc failed\n");
> > >  		goto exit_buf_free;
> > > +	}
> > 
> > You should have already gotten an error message from the log if this
> > fails, from the kmalloc_array() call failing, right?
> > 
> > So why is this needed?  We have been trying to remove these types of
> > messages and keep them in the "root" place where the failure happens.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Didn't notice that. I agree that this will result only into redundancy. 
> Quick look over files reveal that there are multiple places
> where people are using print statements after memory allocation fails. 
> Should I go ahead and send patches to remove those
> redundant print statements?

It all depends on where in the kernel those are.  Some subsystems want
minor cleanups like this, but most do not.  So unless the issue you find
is in the drivers/staging/ directory, I would not worry about it.

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Keyur Patel <iamkeyur96@gmail.com>
Cc: devel@driverdev.osuosl.org, Alex Elder <elder@kernel.org>,
	linux-kernel@vger.kernel.org, Johan Hovold <johan@kernel.org>,
	David Lin <dtwlin@gmail.com>,
	greybus-dev@lists.linaro.org
Subject: Re: [PATCH] staging: greybus: add logging statement when kfifo_alloc fails
Date: Thu, 11 Jul 2019 09:00:42 +0200	[thread overview]
Message-ID: <20190711070042.GA28487@kroah.com> (raw)
In-Reply-To: <20190710142406.GA6669@keyur-pc>

On Wed, Jul 10, 2019 at 10:24:06AM -0400, Keyur Patel wrote:
> On Wed, Jul 10, 2019 at 06:35:38PM +0200, Greg Kroah-Hartman wrote:
> > On Wed, Jul 10, 2019 at 08:20:17AM -0400, Keyur Patel wrote:
> > > Added missing logging statement when kfifo_alloc fails, to improve
> > > debugging.
> > > 
> > > Signed-off-by: Keyur Patel <iamkeyur96@gmail.com>
> > > ---
> > >  drivers/staging/greybus/uart.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
> > > index b3bffe91ae99..86a395ae177d 100644
> > > --- a/drivers/staging/greybus/uart.c
> > > +++ b/drivers/staging/greybus/uart.c
> > > @@ -856,8 +856,10 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev,
> > >  
> > >  	retval = kfifo_alloc(&gb_tty->write_fifo, GB_UART_WRITE_FIFO_SIZE,
> > >  			     GFP_KERNEL);
> > > -	if (retval)
> > > +	if (retval) {
> > > +		pr_err("kfifo_alloc failed\n");
> > >  		goto exit_buf_free;
> > > +	}
> > 
> > You should have already gotten an error message from the log if this
> > fails, from the kmalloc_array() call failing, right?
> > 
> > So why is this needed?  We have been trying to remove these types of
> > messages and keep them in the "root" place where the failure happens.
> > 
> > thanks,
> > 
> > greg k-h
> 
> Didn't notice that. I agree that this will result only into redundancy. 
> Quick look over files reveal that there are multiple places
> where people are using print statements after memory allocation fails. 
> Should I go ahead and send patches to remove those
> redundant print statements?

It all depends on where in the kernel those are.  Some subsystems want
minor cleanups like this, but most do not.  So unless the issue you find
is in the drivers/staging/ directory, I would not worry about it.

thanks,

greg k-h
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

  reply	other threads:[~2019-07-11  7:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10 12:20 [PATCH] staging: greybus: add logging statement when kfifo_alloc fails Keyur Patel
2019-07-10 12:20 ` Keyur Patel
2019-07-10 16:35 ` Greg Kroah-Hartman
2019-07-10 16:35   ` Greg Kroah-Hartman
2019-07-10 14:24   ` Keyur Patel
2019-07-10 14:24     ` Keyur Patel
2019-07-11  7:00     ` Greg Kroah-Hartman [this message]
2019-07-11  7:00       ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190711070042.GA28487@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=dtwlin@gmail.com \
    --cc=elder@kernel.org \
    --cc=greybus-dev@lists.linaro.org \
    --cc=iamkeyur96@gmail.com \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.