public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver
Date: Sat, 29 Jul 2017 06:34:03 -0700	[thread overview]
Message-ID: <20170729133403.GB8007@kroah.com> (raw)
In-Reply-To: <1501316283-8604-1-git-send-email-baolu.lu@linux.intel.com>

On Sat, Jul 29, 2017 at 04:18:03PM +0800, Lu Baolu wrote:
> +static void xhci_debugfs_create_files(struct xhci_hcd *xhci,
> +				      struct xhci_file_map *files,
> +				      size_t nentries, void *data,
> +				      struct dentry *parent,
> +				      const struct file_operations *fops)
> +{
> +	int			i;
> +	struct dentry		*file;
> +
> +	for (i = 0; i < nentries; i++) {
> +		file = debugfs_create_file(files[i].name, 0444,
> +					   parent, data, fops);
> +		if (IS_ERR_OR_NULL(file))
> +			break;

There's no need to ever check the return value of a debugfs_ function,
there's nothing you can do here, just keep calling it :)

And you will not get an error, you will only get NULL if there is an
error, as the only error you would get is if debugfs was not enabled.

> +static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci,
> +						   struct xhci_ring *ring,
> +						   const char *name,
> +						   struct dentry *parent)
> +{
> +	struct dentry		*dir;
> +
> +	dir = debugfs_create_dir(name, parent);
> +	if (IS_ERR_OR_NULL(dir))
> +		return NULL;

Same here.  Just keep going, you don't care about the return value, but
you can use it safely no matter what.


Same for other places in this patch as well.

thanks,

greg k-h

  reply	other threads:[~2017-07-29 13:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-29  8:18 [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver Lu Baolu
2017-07-29 13:34 ` Greg KH [this message]
2017-07-30  3:05   ` Lu Baolu

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=20170729133403.GB8007@kroah.com \
    --to=greg@kroah.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@linux.intel.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