From patchwork Fri Jul 28 18:48:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Gerlach X-Patchwork-Id: 9869237 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 0A5A560382 for ; Fri, 28 Jul 2017 18:49:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC44927F7F for ; Fri, 28 Jul 2017 18:48:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD72928539; Fri, 28 Jul 2017 18:48:59 +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.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 2B18A27F7F for ; Fri, 28 Jul 2017 18:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752236AbdG1Ssh (ORCPT ); Fri, 28 Jul 2017 14:48:37 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:12751 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbdG1Ssh (ORCPT ); Fri, 28 Jul 2017 14:48:37 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v6SImV5w015555; Fri, 28 Jul 2017 13:48:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1501267711; bh=0wqx5Fv+RNTC3hexAr27TYpuF3d7EcUtajxd7K6MW1s=; h=From:To:CC:Subject:Date; b=T/mI5LLj3QkB8Jcl2d3GgotgzkciasTqezdm572VKTjplHLvALy9BZSqXyzHKYdyZ ck7b333VCjL3l8aff0ypIu1MWOW27+2huzl/5QvHF4b3wSpXk52Nq0MUYVGmJVAAvX wpZaaIYqAyQxnPmEuVUKBClSMtvO+hcAprmwx+CM= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6SImVxE005908; Fri, 28 Jul 2017 13:48:31 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Fri, 28 Jul 2017 13:48:30 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v6SImVXR013148; Fri, 28 Jul 2017 13:48:31 -0500 Received: from localhost (uda0274052.dhcp.ti.com [128.247.59.203]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id v6SImV323420; Fri, 28 Jul 2017 13:48:31 -0500 (CDT) From: Dave Gerlach To: Ulf Hansson , "Rafael J . Wysocki" , Kevin Hilman CC: , , Thara Gopinath , Dave Gerlach Subject: [PATCH] PM / Domains: Ensure genpd name is set before creating debugfs entry Date: Fri, 28 Jul 2017 13:48:18 -0500 Message-ID: <20170728184818.1306-1-d-gerlach@ti.com> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit b6a1d093f96b ("PM / Domains: Extend generic power domain debugfs") extends the existing generic power domain debugfs to provide more information about each genpd, however it creates a debugfs directory for each based on the name of the genpd. While it is a good idea to populate the name field of each genpd, up until this commit it was not required. However, attempting to call debugfs_create_dir with a null name value causes a NULL pointer dereference panic. In order to keep things working as they did before the aforementioned patch, check to see if name has been populated and if not, skip creating the extended debugfs info path and warn that name is needed to get this extended info. Fixes: b6a1d093f96b ("PM / Domains: Extend generic power domain debugfs") Signed-off-by: Dave Gerlach --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 43fd08e50ae9..77f7ea6f7fc3 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2575,6 +2575,12 @@ static int __init pm_genpd_debug_init(void) return -ENOMEM; list_for_each_entry(genpd, &gpd_list, gpd_list_node) { + if (!genpd->name) { + pr_warn("%s: Must populate name of genpd for extended debugfs info.", + __func__); + continue; + } + d = debugfs_create_dir(genpd->name, pm_genpd_debugfs_dir); if (!d) return -ENOMEM;