Received: by 10.223.176.46 with SMTP id f43csp3902357wra; Tue, 23 Jan 2018 00:42:19 -0800 (PST) X-Google-Smtp-Source: AH8x226aVDtBYLlj3XUC3LwyMDXcA6zpudxnsO79yeGjDhlnqzJr5io++lIOhB8IcproOMrE5pks X-Received: by 10.99.100.131 with SMTP id y125mr8109946pgb.359.1516696938949; Tue, 23 Jan 2018 00:42:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516696938; cv=none; d=google.com; s=arc-20160816; b=LpNk1j+7o8IN8tGHCBa6/Q2qzgLthY/y16fYX+ClrYFIgZD/PR2cuTr8R+7Ai/ZoMJ l2SNeh1k1leLnb6HjRLOmtei48GnCSPMQfGxzDMAUzvN0Gou2fbWeFJko6WItDdb+np1 A8x3xcY8d1Z+zcMXhqp7KpRaoix7HuMwduI59aS5bvj7KSPVo/P4AXDTG3tOqK12UShS 6QJUTDV1B7NXM6zyApll6mbNSDu6slZKSuZF/S83+aoIhqd7jagWSKwI8Y/sYezfhBAn q9RP2Crx8UlL2qZwgAGhDWlbewAxYJG79095kYuOJlxL9aHNn/qLVi7pEE8yITe+qMGZ xubw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=XXKEggIKWmVInkKKyxAz4bf8EgulWx6wp1X0ONREyLc=; b=GW28gFj9WokeZOEAyPL42Zqbk3/QNE4DqEpQ1eEqVTNcmu3i1Xr+wiCoxfJ++FE1hL DPbYtk74tIHPP8EMklwIlTpcJ1jCmajZ64zfJWIUjPbBMEuyExqNMScr+988D3dZZRM3 r+V85bNwpc6T5GQMx1ZZg7zqBRmqoVBmiTfpbIgwpAu+4WnSXXVYRcVpq/0yVlzOIMh8 sm8uYjE1Gj6wfh/hJFAiZbpwwKH1XW6FXi0KNatq6NRt6g0ZYanO9xgGmZnAS7ddvCzK EShbWbhEcOUByx9f6AA9U3I6OBeQAACOPW5A6wxStWl8leHU/YqI9uHqHyIODTdnbcOH PmcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si14506483pgc.330.2018.01.23.00.42.04; Tue, 23 Jan 2018 00:42:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751215AbeAWIlF (ORCPT + 99 others); Tue, 23 Jan 2018 03:41:05 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:46288 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751027AbeAWIlE (ORCPT ); Tue, 23 Jan 2018 03:41:04 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 17F7AED4; Tue, 23 Jan 2018 08:41:03 +0000 (UTC) Date: Tue, 23 Jan 2018 09:41:03 +0100 From: Greg KH To: Jolly Shah Cc: ard.biesheuvel@linaro.org, mingo@kernel.org, matt@codeblueprint.co.uk, sudeep.holla@arm.com, hkallweit1@gmail.com, keescook@chromium.org, dmitry.torokhov@gmail.com, michal.simek@xilinx.com, robh+dt@kernel.org, mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, rajanv@xilinx.com, Jolly Shah Subject: Re: [PATCH v2 4/4] drivers: firmware: xilinx: Add debugfs interface Message-ID: <20180123084103.GC21463@kroah.com> References: <1516220434-22204-1-git-send-email-jollys@xilinx.com> <1516220434-22204-5-git-send-email-jollys@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516220434-22204-5-git-send-email-jollys@xilinx.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 17, 2018 at 12:20:34PM -0800, Jolly Shah wrote: > +/* Setup debugfs fops */ > +static const struct file_operations fops_zynqmp_pm_dbgfs = { > + .owner = THIS_MODULE, > + .write = zynqmp_pm_debugfs_api_write, > + .read = zynqmp_pm_debugfs_api_version_read, > +}; > + > +/** > + * zynqmp_pm_api_debugfs_init - Initialize debugfs interface > + * > + * Return: Returns 0 on success > + * Corresponding error code otherwise > + */ > +int zynqmp_pm_api_debugfs_init(void) > +{ > + int err; > + > + /* Initialize debugfs interface */ > + zynqmp_pm_debugfs_dir = debugfs_create_dir(DRIVER_NAME, NULL); > + if (!zynqmp_pm_debugfs_dir) { > + pr_err("debugfs_create_dir failed\n"); > + return -ENODEV; > + } No, you should NEVER care if a debugfs call returned an error or not, no need to check it at all. Your code path should not change based on the return value as no code should depened on the functionality of debugfs. Any error returned by a debugfs call can be passed right back into it with no problems, so again, no need to check this. > + > + zynqmp_pm_debugfs_power = > + debugfs_create_file("pm", 0220, > + zynqmp_pm_debugfs_dir, NULL, > + &fops_zynqmp_pm_dbgfs); > + if (!zynqmp_pm_debugfs_power) { > + pr_err("debugfs_create_file power failed\n"); > + err = -ENODEV; > + goto err_dbgfs; > + } > + > + zynqmp_pm_debugfs_api_version = > + debugfs_create_file("api_version", 0444, > + zynqmp_pm_debugfs_dir, NULL, > + &fops_zynqmp_pm_dbgfs); > + if (!zynqmp_pm_debugfs_api_version) { > + pr_err("debugfs_create_file api_version failed\n"); > + err = -ENODEV; > + goto err_dbgfs; > + } Why do you save these dentries at all anyway? You never do anything with them, just create the files and away you go, no need to worry about anything. Remember, debugfs was created to be very simple to use, don't make it more complex than it has to be please. thanks, greg k-h