From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224Aiiz3GcCKRQhcr1QnUFyRMSP5B/J5SmW8zoKmAomcS+xnyMqguTYq5cyKz1oTCUb102XE ARC-Seal: i=1; a=rsa-sha256; t=1516836836; cv=none; d=google.com; s=arc-20160816; b=fT860zQounylRUZhNE+iEJ60w4GR1HvTntXYwobS2afNHjn6/d24PwcXA4dMmQo3ZA Qol1aRgeGtfQtSWB302YXHSSzU0y4Lm5hfaAMmJmUljCxo4PkCL2a0Ya9Yyb/+3/70OH 6y69xpevqmD4su2MF9nw01MfAwB/nGQS3Rsi6S81stfzkzk3i+As3a/uq+EFloyD9ZdX 0meBAS5hqdSgJquU7qMvK+N3K1YY1HzpARKK0CPIqTtSCq14gfytY7ZdyAG808UIpNbY 28hjZo5qKSshxc1ECo+lf7910VJeakRuCg+gX507GALfMSkqGafp852XG3AjgWzl9Qlh Gqfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:content-transfer-encoding:spamdiagnosticmetadata :spamdiagnosticoutput:content-language:accept-language:in-reply-to :references:message-id:date:thread-index:thread-topic:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=ushxywlMbknEjbdxZzUAToMKlmtxkLFTwghSXort82U=; b=ri3WgXw+vb4OV65AVjAmThz51URvYOqTsxa6p1r8wPntYWmZydeJ1tp7voNB32hV4u ZIK7gg4d5kH44aCuqjr5fO2SgxHiLCunKpCt3RJCv2f314JnJlpPYyQxQYRxQnNEyXZM bi+qNBPOLqlyFKfpiQpmr/tzk0O73Mj8c02kZXcjvjq+HR6r7MfPf0/awvfowZYSRy4Z ICuScJ0BKCc7afb+zW/dUAjLqlWBdMuIVVCyZwZ42VwOz5CIWZKEHbaGXsnUywFMaHEJ yq/OOz0RE2PWP9O+V2GnhvNgE/qaVvdkLSIj1x/Khmtc+DjtWlMoal0c2nSaOay1L2by aRIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=ncONW3uG; spf=pass (google.com: domain of jollys@xilinx.com designates 104.47.34.45 as permitted sender) smtp.mailfrom=JOLLYS@xilinx.com Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=ncONW3uG; spf=pass (google.com: domain of jollys@xilinx.com designates 104.47.34.45 as permitted sender) smtp.mailfrom=JOLLYS@xilinx.com From: Jolly Shah To: Greg KH 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" , Rajan Vaja Subject: RE: [PATCH v2 4/4] drivers: firmware: xilinx: Add debugfs interface Thread-Topic: [PATCH v2 4/4] drivers: firmware: xilinx: Add debugfs interface Thread-Index: AQHTj9C4N94YbWHDL0OafTlHkpZPOKOBLCyAgAKK7ZA= Date: Wed, 24 Jan 2018 23:33:50 +0000 Message-ID: References: <1516220434-22204-1-git-send-email-jollys@xilinx.com> <1516220434-22204-5-git-send-email-jollys@xilinx.com> <20180123084103.GC21463@kroah.com> In-Reply-To: <20180123084103.GC21463@kroah.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=JOLLYS@xilinx.com; x-originating-ip: [149.199.62.254] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DM2PR0201MB0832;7:yqp4vKS2QYye/T7Fqyk/E9twzwFa2gr7ogOI5kk64KzsMKNrSJsppb7aHfR3EAOHcc8n8UKXGt7ZBtoXeZv3+qUK7sfKpYsULUZwLO7GhxOiiidCttAWp0UanGiOrui/70NtpGwIIZ0j6DGK0JsQs/zBZ89MMXqDlkGRW8RBf+FGHZvHXhBigcHh33szTRS4lBSTvVkr2R9TJXg9l9Nd0GYd1tpfrOr4089yVYZVSDy0V+KNZjNbbh1ZQEorMA/n x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(39860400002)(346002)(366004)(396003)(376002)(39380400002)(189003)(199004)(13464003)(81166006)(72206003)(14454004)(33656002)(7416002)(107886003)(97736004)(106356001)(6436002)(39060400002)(55016002)(2900100001)(2950100002)(5660300001)(6916009)(102836004)(74316002)(7736002)(25786009)(5250100002)(4326008)(305945005)(26005)(59450400001)(6506007)(66066001)(229853002)(316002)(53546011)(54906003)(3280700002)(76176011)(7696005)(9686003)(6246003)(99286004)(105586002)(478600001)(2906002)(3660700001)(81156014)(8936002)(86362001)(8676002)(53936002)(68736007)(6116002)(186003)(3846002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR0201MB0832;H:DM2PR0201MB0767.namprd02.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3742e745-bd1f-4047-9044-08d56382ec6c x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);SRVR:DM2PR0201MB0832; x-ms-traffictypediagnostic: DM2PR0201MB0832: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(9452136761055)(85827821059158)(258649278758335)(192813158149592); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(2400081)(944501161)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123562045)(20161123560045)(6072148)(201708071742011);SRVR:DM2PR0201MB0832;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0201MB0832; x-forefront-prvs: 056297E276 x-microsoft-antispam-message-info: OHjQaMSiScueuCGpuACU28pmuvRcXpaNwh5C62LvwiXkD1ilAaadqVlpGzsKKS/r1QIJVK1vEm2XigYjTCK6jA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3742e745-bd1f-4047-9044-08d56382ec6c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jan 2018 23:33:50.4510 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR0201MB0832 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1589872402210925209?= X-GMAIL-MSGID: =?utf-8?q?1590518702615099115?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Thanks for review Greg, > -----Original Message----- > From: Greg KH [mailto:gregkh@linuxfoundation.org] > Sent: Tuesday, January 23, 2018 12:41 AM > 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; Rajan Vaja > ; Jolly Shah > Subject: Re: [PATCH v2 4/4] drivers: firmware: xilinx: Add debugfs interf= ace >=20 > 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 =3D { > > + .owner =3D THIS_MODULE, > > + .write =3D zynqmp_pm_debugfs_api_write, > > + .read =3D 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 =3D debugfs_create_dir(DRIVER_NAME, NULL)= ; > > + if (!zynqmp_pm_debugfs_dir) { > > + pr_err("debugfs_create_dir failed\n"); > > + return -ENODEV; > > + } >=20 > 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 va= lue as > no code should depened on the functionality of debugfs. >=20 > Any error returned by a debugfs call can be passed right back into it wit= h no > problems, so again, no need to check this. >=20 Fixed in v3 patch series. Not saving dentries anymore but added check to sh= ow warning message instead of error. > > + > > + zynqmp_pm_debugfs_power =3D > > + 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 =3D -ENODEV; > > + goto err_dbgfs; > > + } > > + > > + zynqmp_pm_debugfs_api_version =3D > > + 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 =3D -ENODEV; > > + goto err_dbgfs; > > + } >=20 > 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 anyth= ing. >=20 > Remember, debugfs was created to be very simple to use, don't make it mor= e > complex than it has to be please. >=20 > thanks, >=20 > greg k-h Fixed in v3 patch series. Thanks, Jolly Shah