From patchwork Wed Jun 12 12:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10989745 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 028B314B6 for ; Wed, 12 Jun 2019 12:13:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E41E628A19 for ; Wed, 12 Jun 2019 12:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D85F128A1E; Wed, 12 Jun 2019 12:13:07 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 7490728A19 for ; Wed, 12 Jun 2019 12:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbfFLMNH (ORCPT ); Wed, 12 Jun 2019 08:13:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfFLMNG (ORCPT ); Wed, 12 Jun 2019 08:13:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 7B20A208C2; Wed, 12 Jun 2019 12:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341586; bh=u6+QfhTdC84UGP3uD6drBmy8AzLg6rTBFjv6qN+rV7U=; h=From:To:Cc:Subject:Date:From; b=1i+HmfwBwxsBg4QZGtn5RFlNgABFojDI0lKlCihgLE8lZJpTlwf1rlNA6edMAzAJG DP18t54RXiluJz4zwvlAMjG8LlISemQL3+KMPUnb1ID8lnxndmkNa5Z9wHq9esN1A3 LI+x/N1GoPcREOyHMTYDnrfmGcq1laGyvBCIetZw= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , "Lee, Chun-Yi" , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] platform: x86: acer-wmi: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:51 +0200 Message-Id: <20190612121258.19535-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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. Also, because there is no need to save the file dentry, remove the variable that was saving it and just recursively delete the whole directory. Cc: "Lee, Chun-Yi" Cc: Darren Hart Cc: Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/acer-wmi.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 521b526cd467..f8f0e98b1f0b 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -259,7 +259,6 @@ struct acer_data { struct acer_debug { struct dentry *root; - struct dentry *devices; u32 wmid_devices; }; @@ -2148,29 +2147,15 @@ static struct platform_device *acer_platform_device; static void remove_debugfs(void) { - debugfs_remove(interface->debug.devices); - debugfs_remove(interface->debug.root); + debugfs_remove_recursive(interface->debug.root); } -static int __init create_debugfs(void) +static void __init create_debugfs(void) { interface->debug.root = debugfs_create_dir("acer-wmi", NULL); - if (!interface->debug.root) { - pr_err("Failed to create debugfs directory"); - return -ENOMEM; - } - interface->debug.devices = debugfs_create_u32("devices", S_IRUGO, - interface->debug.root, - &interface->debug.wmid_devices); - if (!interface->debug.devices) - goto error_debugfs; - - return 0; - -error_debugfs: - remove_debugfs(); - return -ENOMEM; + debugfs_create_u32("devices", S_IRUGO, interface->debug.root, + &interface->debug.wmid_devices); } static int __init acer_wmi_init(void) @@ -2300,9 +2285,7 @@ static int __init acer_wmi_init(void) if (wmi_has_guid(WMID_GUID2)) { interface->debug.wmid_devices = get_wmid_devices(); - err = create_debugfs(); - if (err) - goto error_create_debugfs; + create_debugfs(); } /* Override any initial settings with values from the commandline */ @@ -2310,8 +2293,6 @@ static int __init acer_wmi_init(void) return 0; -error_create_debugfs: - platform_device_del(acer_platform_device); error_device_add: platform_device_put(acer_platform_device); error_device_alloc: