All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@linuxfoundation.org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 04/13] staging: vc04_services: no need to check debugfs return values
Date: Fri, 1 Jun 2018 13:09:44 +0200	[thread overview]
Message-ID: <20180601110944.GA1575@kroah.com> (raw)
In-Reply-To: <874lioorbj.fsf@anholt.net>

On Wed, May 30, 2018 at 12:51:12PM -0700, Eric Anholt wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > When calling debugfs functions, there is no need to ever check the
> > return value.  The function can work or not, but the code logic should
> > never do something different based on this.
> >
> > Clean up the vchiq_arm code by not caring about the value of debugfs
> > calls.  This ends up removing a number of lines of code that are not
> > needed.
> >
> > Cc: Eric Anholt <eric@anholt.net>
> > Cc: Stefan Wahren <stefan.wahren@i2se.com>
> > Cc: Kees Cook <keescook@chromium.org>
> > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Keerthi Reddy <keerthigd4990@gmail.com>
> > Cc: linux-rpi-kernel at lists.infradead.org
> > Cc: linux-arm-kernel at lists.infradead.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  .../interface/vchiq_arm/vchiq_arm.c           | 13 +---
> >  .../interface/vchiq_arm/vchiq_debugfs.c       | 72 +++----------------
> >  .../interface/vchiq_arm/vchiq_debugfs.h       |  4 +-
> >  3 files changed, 15 insertions(+), 74 deletions(-)
> >
> 
> > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> > index 766b4fe5f32c..103fec955e2c 100644
> > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
> 
> > @@ -314,31 +284,13 @@ void vchiq_debugfs_remove_instance(VCHIQ_INSTANCE_T instance)
> >  	debugfs_remove_recursive(node->dentry);
> >  }
> >  
> > -int vchiq_debugfs_init(void)
> > +void vchiq_debugfs_init(void)
> >  {
> > -	BUG_ON(debugfs_info.vchiq_cfg_dir != NULL);
> > -
> >  	debugfs_info.vchiq_cfg_dir = debugfs_create_dir("vchiq", NULL);
> > -	if (debugfs_info.vchiq_cfg_dir == NULL)
> > -		goto fail;
> > -
> 
> I think now that we allow successful probe with this value NULL, module
> remove could vchiq_debugfs_deinit() -> vchiq_debugfs_top() -> BUG_ON().
> I think the right solution would be to just drop that BUG_ON().  With
> that change (and probably just garbage-collecting that function), this
> will be enthusiastically:
> 
> Reviewed-by: Eric Anholt <eric@anholt.net>

Much better idea, I just did that and will send out the patch series
now.  The end result is nicer:
 3 files changed, 42 insertions(+), 140 deletions(-)

thanks for the suggestion.

greg k-h

  reply	other threads:[~2018-06-01 11:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180529142947.3250-1-gregkh@linuxfoundation.org>
2018-05-29 14:29 ` [PATCH 04/13] staging: vc04_services: no need to check debugfs return values Greg Kroah-Hartman
2018-05-30 19:51   ` Eric Anholt
2018-06-01 11:09     ` Greg Kroah-Hartman [this message]
2018-05-29 14:29 ` [lustre-devel] [PATCH 05/13] staging: lustre: " Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 06/13] staging: lustre: remove ldebugfs_add_simple() wrapper Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 07/13] staging: lustre: remove ldebugfs_register_stats() wrapper function Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 08/13] staging: lustre: remove ldebugfs_seq_create() " Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 09/13] staging: lustre: remove ldebugfs_obd_seq_create() " Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 10/13] staging: lustre: unwrap some ldebugfs_register() calls Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 11/13] staging: lustre: remove last two users of ldebugfs_register() Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 12/13] staging: lustre: make ldebugfs_add_vars a void function Greg Kroah-Hartman
2018-05-29 14:29 ` [lustre-devel] [PATCH 13/13] staging: lustre: get rid of ldebugfs_remove() 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=20180601110944.GA1575@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.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.