Re: [PATCH 04/13] staging: vc04_services: no need to check debugfs return values

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

 



On Wed, May 30, 2018 at 12:51:12PM -0700, Eric Anholt wrote:
> Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxx>
> > Cc: Stefan Wahren <stefan.wahren@xxxxxxxx>
> > Cc: Kees Cook <keescook@xxxxxxxxxxxx>
> > Cc: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> > Cc: Arnd Bergmann <arnd@xxxxxxxx>
> > Cc: Keerthi Reddy <keerthigd4990@xxxxxxxxx>
> > Cc: linux-rpi-kernel@xxxxxxxxxxxxxxxxxxx
> > Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> > Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> > ---
> >  .../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@xxxxxxxxxx>

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
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux