Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp566405pxb; Tue, 19 Oct 2021 08:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYvCN7JrmVGP6G2iztcVKp1rHDGV3ojv8Q64Y+hsb2QR7i2hhfy1iXIvNW2sXM7aAc2N9g X-Received: by 2002:a17:90a:fb4a:: with SMTP id iq10mr485033pjb.117.1634657478797; Tue, 19 Oct 2021 08:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634657478; cv=none; d=google.com; s=arc-20160816; b=mn8Z9xZHMcl8IL3u70vlwWv3DyVX36Wo7vNxCBGvOLxYJBdzFYNfFST5HmdBlQgVeX m6bfQ72Pu6HDqd8TA4jK8mugKxydaM4gB89IRYsbTGewcTZMoxfYowispxMzyFPR+kfJ y/faLszEM5oFNlKUH6TTYxOmoGKekX4DOhyWx2max4D9gxEQDhyHjzzzD2BxE7Yj5Z90 u//RryWFEDg2TY0cLW+3Tcjenrp0mk2NajTWIEMPpKgbQnE3e/Xhbwzqgzdzn3Jyqyb+ pDPTSp0iGpiwkLjD3hV6bfMpBwd5HAhGm1rIaLe7WCE2y8WdF4vkkkr10m2xWHa3XV8V mW0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dmarc-filter:sender :dkim-signature; bh=LVzzb3yrucDEEYBFzUmu/dmux61ZBBksS7TOjiqw6Kc=; b=GH6KRTRRj5vtdWJpnEn61s44NGx9N22iX48D3ygM/tJO9yojXZPKOYXcqEvIohTZlx dEiCO4YBKHEVI1ipYQoE3zHh+yeqrevekYsuZJ+nraeBsjsbEinjiDZv4ln8T3/AlkAN 5N9cz1dPYPfi2k4jelCg5y9QDdrJrseqihgr6ZORrlJWWDzOlMaIH9ryESxri72UJttP kxiStFAPE1OATxXuK77HilnfvCyRXJhycaBekJsWq+OT2LnefaMsx2RYXumIUR7JydSo mhl7GcZL5GxMyt9kjbHUfRlEx8/J9OjbHmJui/HbXeE1lmtK/RdwXN5KhjRUd5Ao1t4B ZMQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=S733tpst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 198si6791312pga.314.2021.10.19.08.31.04; Tue, 19 Oct 2021 08:31:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=S733tpst; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231460AbhJSPbU (ORCPT + 99 others); Tue, 19 Oct 2021 11:31:20 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:30588 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229803AbhJSPbT (ORCPT ); Tue, 19 Oct 2021 11:31:19 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1634657347; h=Content-Transfer-Encoding: MIME-Version: Message-Id: Date: Subject: Cc: To: From: Sender; bh=LVzzb3yrucDEEYBFzUmu/dmux61ZBBksS7TOjiqw6Kc=; b=S733tpstsLE34Hn9kJwyeEy34pgDZDC2E5Jc7JHERAVvxeZWf+cWJ7REETg43f7rMj0wN8xT tJFAAkAhoY5acryfHwCIA8CZ32xlbLN3ZuVR46/zyMh/VFeF59IntmgnMfJ4BsqhWavpF6Rn Apo+yto95xV/kVxuefAJoGRICw8= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n07.prod.us-west-2.postgun.com with SMTP id 616ee4355ca800b6c1d1f2bf (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 19 Oct 2021 15:28:53 GMT Sender: clingutla=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 6D00EC43635; Tue, 19 Oct 2021 15:28:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from lingutla-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: clingutla) by smtp.codeaurora.org (Postfix) with ESMTPSA id F0375C43617; Tue, 19 Oct 2021 15:28:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 smtp.codeaurora.org F0375C43617 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=codeaurora.org From: Lingutla Chandrasekhar To: lukasz.luba@arm.com, rafael.j.wysocki@intel.com, qperret@google.com, daniel.lezcano@linaro.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Lingutla Chandrasekhar Subject: [PATCH] PM: EM: do not allow pd creation prior to debugfs initialization Date: Tue, 19 Oct 2021 20:58:19 +0530 Message-Id: <20211019152819.6141-1-clingutla@codeaurora.org> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org em_dev_register_perf_domain() can be called from any initcall level before debugfs initialization, this allowed to create power domain debug entries of the caller at unintended root_dir. Fix it by not allowing creation of power domain debug entries, if root_dir is not available. Signed-off-by: Lingutla Chandrasekhar diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c index a332ccd829e2..fe5a207d4023 100644 --- a/kernel/power/energy_model.c +++ b/kernel/power/energy_model.c @@ -68,6 +68,11 @@ static void em_debug_create_pd(struct device *dev) struct dentry *d; int i; + if (!rootdir) { + pr_err("EM: energy_model debug is not available yet\n"); + return; + } + /* Create the directory of the performance domain */ d = debugfs_create_dir(dev_name(dev), rootdir); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.