public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Steve Wise <swise@opengridcomputing.com>
Cc: Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org
Subject: Re: [PATCH 1/8] infiniband: cxgb4: no need to check return value of debugfs_create functions
Date: Tue, 22 Jan 2019 17:30:57 +0100	[thread overview]
Message-ID: <20190122163057.GA23510@kroah.com> (raw)
In-Reply-To: <dbf27d3d-ff19-4054-9495-80bcb5a10485@opengridcomputing.com>

On Tue, Jan 22, 2019 at 10:22:59AM -0600, Steve Wise wrote:
> Hey Greg,
> 
> On 1/22/2019 9:17 AM, Greg Kroah-Hartman wrote:
> > 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.
> > 
> > Cc: Steve Wise <swise@chelsio.com>
> > Cc: Doug Ledford <dledford@redhat.com>
> > Cc: Jason Gunthorpe <jgg@ziepe.ca>
> > Cc: linux-rdma@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  drivers/infiniband/hw/cxgb4/device.c | 8 +-------
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> > 
> > diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c
> > index c13c0ba30f63..9c10fff6dcfb 100644
> > --- a/drivers/infiniband/hw/cxgb4/device.c
> > +++ b/drivers/infiniband/hw/cxgb4/device.c
> > @@ -720,11 +720,8 @@ static const struct file_operations ep_debugfs_fops = {
> >  	.read    = debugfs_read,
> >  };
> >  
> > -static int setup_debugfs(struct c4iw_dev *devp)
> > +static void setup_debugfs(struct c4iw_dev *devp)
> >  {
> > -	if (!devp->debugfs_root)
> > -		return -1;
> > -
> >  	debugfs_create_file_size("qps", S_IWUSR, devp->debugfs_root,
> >  				 (void *)devp, &qp_debugfs_fops, 4096);
> >  
> > @@ -740,7 +737,6 @@ static int setup_debugfs(struct c4iw_dev *devp)
> >  	if (c4iw_wr_log)
> >  		debugfs_create_file_size("wr_log", S_IWUSR, devp->debugfs_root,
> >  					 (void *)devp, &wr_log_debugfs_fops, 4096);
> > -	return 0;
> >  }
> >  
> >  void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev,
> > @@ -1553,8 +1549,6 @@ static int __init c4iw_init_module(void)
> >  		return err;
> >  
> >  	c4iw_debugfs_root = debugfs_create_dir(DRV_NAME, NULL);
> > -	if (!c4iw_debugfs_root)
> > -		pr_warn("could not create debugfs entry, continuing\n");
> >  
> >  	reg_workq = create_singlethread_workqueue("Register_iWARP_device");
> >  	if (!reg_workq) {
> > 
> 
> So it is not a problem to call debugfs_create_file_size() when
> devp->debugfs_root is NULL?

Nope!

> 
> Acked-by: Steve Wise <swise@opengridcomputing.com>

Thanks,

greg k-h

  reply	other threads:[~2019-01-22 16:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-22 15:17 [PATCH 0/8] IB: cleanup debugfs usage Greg Kroah-Hartman
2019-01-22 15:17 ` [PATCH 1/8] infiniband: cxgb4: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-22 16:22   ` Steve Wise
2019-01-22 16:30     ` Greg Kroah-Hartman [this message]
2019-01-22 15:17 ` [PATCH 2/8] infiniband: hfi1: drop crazy DEBUGFS_SEQ_FILE_CREATE() macro Greg Kroah-Hartman
2019-01-22 15:17 ` [PATCH 3/8] infiniband: hfi1: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-01-22 15:17 ` [PATCH 4/8] infiniband: qib: " Greg Kroah-Hartman
2019-01-22 15:17 ` [PATCH 5/8] infiniband: mlx5: " Greg Kroah-Hartman
2019-01-22 17:42   ` Leon Romanovsky
2019-01-22 15:17 ` [PATCH 6/8] infiniband: ocrdma: " Greg Kroah-Hartman
2019-01-22 15:17 ` [PATCH 7/8] infiniband: usnic: " Greg Kroah-Hartman
2019-01-23  0:16   ` Parvi Kaustubhi (pkaustub)
2019-01-22 15:18 ` [PATCH 8/8] infiniband: ipoib: " Greg Kroah-Hartman
2019-01-23 21:15 ` [PATCH 0/8] IB: cleanup debugfs usage Jason Gunthorpe

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=20190122163057.GA23510@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=swise@opengridcomputing.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox