Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933260AbcDLLVU (ORCPT ); Tue, 12 Apr 2016 07:21:20 -0400 Received: from mga14.intel.com ([192.55.52.115]:62310 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932409AbcDLLVT (ORCPT ); Tue, 12 Apr 2016 07:21:19 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,473,1455004800"; d="scan'208";a="783193887" From: changbin.du@intel.com To: balbi@kernel.org Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, "Du, Changbin" Subject: [PATCH v4 1/2] usb: dwc3: make dwc3_debugfs_init return value be void Date: Tue, 12 Apr 2016 19:10:18 +0800 Message-Id: <1460459419-9487-2-git-send-email-changbin.du@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460459419-9487-1-git-send-email-changbin.du@intel.com> References: <1460459419-9487-1-git-send-email-changbin.du@intel.com> In-Reply-To: <87potwo0d2.fsf@intel.com> References: <87potwo0d2.fsf@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4028 Lines: 156 From: "Du, Changbin" Debugfs init failure is not so important. We can continue our job on this failure. Also no break need for debugfs_create_file call failure. Signed-off-by: Du, Changbin --- v4: Do not fail silently, but print error. --- drivers/usb/dwc3/core.c | 10 +-------- drivers/usb/dwc3/debug.h | 6 ++--- drivers/usb/dwc3/debugfs.c | 56 +++++++++++++++++----------------------------- 3 files changed, 24 insertions(+), 48 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 17fd814..30f825c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1062,19 +1062,11 @@ static int dwc3_probe(struct platform_device *pdev) if (ret) goto err5; - ret = dwc3_debugfs_init(dwc); - if (ret) { - dev_err(dev, "failed to initialize debugfs\n"); - goto err6; - } - + dwc3_debugfs_init(dwc); pm_runtime_allow(dev); return 0; -err6: - dwc3_core_exit_mode(dwc); - err5: dwc3_event_buffers_cleanup(dwc); diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h index 07fbc2d..71e3180 100644 --- a/drivers/usb/dwc3/debug.h +++ b/drivers/usb/dwc3/debug.h @@ -217,11 +217,11 @@ static inline const char *dwc3_gadget_event_type_string(u8 event) void dwc3_trace(void (*trace)(struct va_format *), const char *fmt, ...); #ifdef CONFIG_DEBUG_FS -extern int dwc3_debugfs_init(struct dwc3 *); +extern void dwc3_debugfs_init(struct dwc3 *); extern void dwc3_debugfs_exit(struct dwc3 *); #else -static inline int dwc3_debugfs_init(struct dwc3 *d) -{ return 0; } +static inline void dwc3_debugfs_init(struct dwc3 *d) +{ } static inline void dwc3_debugfs_exit(struct dwc3 *d) { } #endif diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 9ac37fe..615d4dc 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -618,24 +618,24 @@ static const struct file_operations dwc3_link_state_fops = { .release = single_release, }; -int dwc3_debugfs_init(struct dwc3 *dwc) +void dwc3_debugfs_init(struct dwc3 *dwc) { struct dentry *root; - struct dentry *file; - int ret; + struct dentry *file; root = debugfs_create_dir(dev_name(dwc->dev), NULL); - if (!root) { - ret = -ENOMEM; - goto err0; + if (IS_ERR_OR_NULL(root)) { + if (!root) + dev_err(dwc->dev, "Can't create debugfs root\n"); + return; } - dwc->root = root; dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); if (!dwc->regset) { - ret = -ENOMEM; - goto err1; + dev_err(dwc->dev, "Failed to alloc regset\n"); + debugfs_remove_recursive(root); + return; } dwc->regset->regs = dwc3_regs; @@ -643,44 +643,28 @@ int dwc3_debugfs_init(struct dwc3 *dwc) dwc->regset->base = dwc->regs; file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); - if (!file) { - ret = -ENOMEM; - goto err1; - } + if (!file) + dev_err(dwc->dev, "Can't create debugfs regdump\n"); if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, dwc, &dwc3_mode_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } + if (!file) + dev_err(dwc->dev, "Can't create debugfs mode\n"); } if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || IS_ENABLED(CONFIG_USB_DWC3_GADGET)) { file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, dwc, &dwc3_testmode_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - - file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_link_state_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - } + if (!file) + dev_err(dwc->dev, "Can't create debugfs testmode\n"); - return 0; - -err1: - debugfs_remove_recursive(root); - -err0: - return ret; + file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, + root, dwc, &dwc3_link_state_fops); + if (!file) + dev_err(dwc->dev, "Can't create debugfs link_state\n"); + } } void dwc3_debugfs_exit(struct dwc3 *dwc) -- 2.5.0