From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753894AbdG3DFk (ORCPT ); Sat, 29 Jul 2017 23:05:40 -0400 Received: from mga05.intel.com ([192.55.52.43]:33599 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753176AbdG3DFj (ORCPT ); Sat, 29 Jul 2017 23:05:39 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,434,1496127600"; d="scan'208";a="293204711" Subject: Re: [PATCH 1/1] usb: xhci: Add debugfs interface for xHCI driver To: Greg KH References: <1501316283-8604-1-git-send-email-baolu.lu@linux.intel.com> <20170729133403.GB8007@kroah.com> Cc: Mathias Nyman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org From: Lu Baolu Message-ID: <597D4D00.5010406@linux.intel.com> Date: Sun, 30 Jul 2017 11:05:36 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <20170729133403.GB8007@kroah.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg, On 07/29/2017 09:34 PM, Greg KH wrote: > 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 for review. I will correct them in a v2 patch. Best regards, Lu Baolu