From patchwork Tue May 29 15:30:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10436243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C67C4602BF for ; Tue, 29 May 2018 15:32:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B607D28782 for ; Tue, 29 May 2018 15:32:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAD1528893; Tue, 29 May 2018 15:32:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 204BA28782 for ; Tue, 29 May 2018 15:32:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935483AbeE2Pb7 (ORCPT ); Tue, 29 May 2018 11:31:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:39780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935078AbeE2Pbz (ORCPT ); Tue, 29 May 2018 11:31:55 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CE52208A0; Tue, 29 May 2018 15:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607914; bh=GO4XwuTXR0zHQX3pJ9qKWyz+pzcPuvSD1MNc24t1TJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I6KNNMgnYxOd2wsIACOZevJkBOA8skF9Mu53sXQvA56wWR6z12LQA8rWyjIfvwnA+ KsH3nRPPLDZv/GM4xSfQu9B0cRVgsmhK89EL5WE3FwHVotr1KnDKCdi0O8EezcLlwm i4jCpWPWHuNHuMm382MR5KEqoKsdETUlZWwGki4U= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Peter Chen Subject: [PATCH 13/22] USB: chipidea: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:30:58 +0200 Message-Id: <20180529153107.12791-13-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529153107.12791-1-gregkh@linuxfoundation.org> References: <20180529153107.12791-1-gregkh@linuxfoundation.org> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Peter Chen Signed-off-by: Greg Kroah-Hartman Acked-by: Peter Chen --- drivers/usb/chipidea/ci.h | 2 +- drivers/usb/chipidea/core.c | 4 +-- drivers/usb/chipidea/debug.c | 56 ++++++++++-------------------------- 3 files changed, 17 insertions(+), 45 deletions(-) diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 98b7cb3d0064..0bf244d50544 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -450,7 +450,7 @@ void hw_phymode_configure(struct ci_hdrc *ci); void ci_platform_configure(struct ci_hdrc *ci); -int dbg_create_files(struct ci_hdrc *ci); +void dbg_create_files(struct ci_hdrc *ci); void dbg_remove_files(struct ci_hdrc *ci); #endif /* __DRIVERS_USB_CHIPIDEA_CI_H */ diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 33ae87fa3ff3..85fc6db48e44 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -1062,9 +1062,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) ci_hdrc_otg_fsm_start(ci); device_set_wakeup_capable(&pdev->dev, true); - ret = dbg_create_files(ci); - if (ret) - goto stop; + dbg_create_files(ci); ret = sysfs_create_group(&dev->kobj, &ci_attr_group); if (ret) diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index ce648cb3ed94..fcc91a338875 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -340,54 +340,28 @@ DEFINE_SHOW_ATTRIBUTE(ci_registers); * * This function returns an error code */ -int dbg_create_files(struct ci_hdrc *ci) +void dbg_create_files(struct ci_hdrc *ci) { - struct dentry *dent; - ci->debugfs = debugfs_create_dir(dev_name(ci->dev), NULL); - if (!ci->debugfs) - return -ENOMEM; - - dent = debugfs_create_file("device", S_IRUGO, ci->debugfs, ci, - &ci_device_fops); - if (!dent) - goto err; - - dent = debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, - ci, &ci_port_test_fops); - if (!dent) - goto err; - - dent = debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci, - &ci_qheads_fops); - if (!dent) - goto err; - dent = debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci, - &ci_requests_fops); - if (!dent) - goto err; + debugfs_create_file("device", S_IRUGO, ci->debugfs, ci, + &ci_device_fops); + debugfs_create_file("port_test", S_IRUGO | S_IWUSR, ci->debugfs, ci, + &ci_port_test_fops); + debugfs_create_file("qheads", S_IRUGO, ci->debugfs, ci, + &ci_qheads_fops); + debugfs_create_file("requests", S_IRUGO, ci->debugfs, ci, + &ci_requests_fops); if (ci_otg_is_fsm_mode(ci)) { - dent = debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci, - &ci_otg_fops); - if (!dent) - goto err; + debugfs_create_file("otg", S_IRUGO, ci->debugfs, ci, + &ci_otg_fops); } - dent = debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci, - &ci_role_fops); - if (!dent) - goto err; - - dent = debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci, - &ci_registers_fops); - - if (dent) - return 0; -err: - debugfs_remove_recursive(ci->debugfs); - return -ENOMEM; + debugfs_create_file("role", S_IRUGO | S_IWUSR, ci->debugfs, ci, + &ci_role_fops); + debugfs_create_file("registers", S_IRUGO, ci->debugfs, ci, + &ci_registers_fops); } /**