Received: by 10.223.176.46 with SMTP id f43csp1370816wra; Wed, 24 Jan 2018 15:34:37 -0800 (PST) X-Google-Smtp-Source: AH8x225mp+nhnbk9IcoGb9UxbhA5TUpVUzI5kJloFNuZmDhb9LHjki1wX6vvWS4+Y5G55ylQZWrd X-Received: by 10.98.15.195 with SMTP id 64mr10036015pfp.225.1516836877245; Wed, 24 Jan 2018 15:34:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516836877; cv=none; d=google.com; s=arc-20160816; b=chOVI5L+vGdAUkVa39K0VPMpMRMB76hbl2y5y88qHv0MxlTKgFOdXx5Eto9UF3J5w3 5Nbj8MYwF7Dv2w4nVrK2jKpMQoWQPVrkNid0VFXhnyXr4vwTr8jE6tylvYLwwdB5NNDS Kkyal62EAmgOBzIZEasYlI1f6dctjAbFMKDmhfIAWGN6Fwo6pqEJ+eZ2+TG8H885asff 4ybAt+8CNCNDQr9RDT9tuGQu8jcdvprTIMkTE41JRzX+btQP94MMdPwOr5LHZ2xVaMZD Jj3vFbXsKXFQcP6YIA1daNfEAXdgOAGj+GkQNBqmvydmpOksTChufDgWAaUnJ7ADDQsw g7KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=stprkRwYcNlbDKlw/RdKWGiN/RdyffnAQDwRvepU22diXyoVHEcn/oNd2doKzi7h1w PnZ6VVDOnMvl2RcJkMwXlpYmyQQ6VriZC28OCZgr2PUXITbw2ZCXfNcU170ig+T681Q6 Vev0QrFM4Ev6mAkAtg5l0nVCHHyd4ZcEUQIXgvlfAThgzQzvtUhWp5ygwbMbiDNCes6O fzr2vly/abKIOE9mnwqXP/678g574SS9zgvsUO8RdGCJArPfBpPQFPO8qB+viw+uCAsa DS5HrgX1cvMn01G7sa0GGe1a7gtmN8SbmRaeZZZP4mgV2vlY0/pD06QFaS5NQGYTygap FyRg== 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: 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 5si709772pgj.750.2018.01.24.15.34.21; Wed, 24 Jan 2018 15:34:37 -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; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector1-xilinx-com header.b=ncONW3uG; 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 S932956AbeAXXd6 (ORCPT + 99 others); Wed, 24 Jan 2018 18:33:58 -0500 Received: from mail-by2nam01on0042.outbound.protection.outlook.com ([104.47.34.42]:2287 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932072AbeAXXd5 (ORCPT ); Wed, 24 Jan 2018 18:33:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ushxywlMbknEjbdxZzUAToMKlmtxkLFTwghSXort82U=; b=ncONW3uGhg+7Q+uuS47xPsxDM1yLfn+7neydxbihjzrnaCNBe56qL6anSjttK1iltuFMlQEgUHXxM2u38D4QrCxQq/m4mrVg2bQYFWQXlpLzqeneG65E4/qiHH1/606hEYo543etNX6kmfGovEpcvy77f6yMZewkU808vu3a+B8= Received: from DM2PR0201MB0767.namprd02.prod.outlook.com (10.160.95.13) by DM2PR0201MB0832.namprd02.prod.outlook.com (10.160.95.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.444.14; Wed, 24 Jan 2018 23:33:51 +0000 Received: from DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1]) by DM2PR0201MB0767.namprd02.prod.outlook.com ([fe80::5d1e:ad23:462e:4de1%14]) with mapi id 15.20.0428.024; Wed, 24 Jan 2018 23:33:50 +0000 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 received-spf: None (protection.outlook.com: xilinx.com does not designate permitted sender hosts) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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