Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1699315

Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver

From Greg KH <greg@kroah.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver
Date 2017-07-29 15:40 +0200
Message-ID <u8A8i-2TU-15@gated-at.bofh.it> (permalink)
References <u8vih-80I-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver Lu Baolu <baolu.lu@linux.intel.com> - 2017-07-29 10:30 +0200
  Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver Greg KH <greg@kroah.com> - 2017-07-29 15:40 +0200
    Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver Lu Baolu <baolu.lu@linux.intel.com> - 2017-07-30 05:10 +0200

csiph-web