From patchwork Wed Jun 28 14:56:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9814449 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 3E1E360365 for ; Wed, 28 Jun 2017 14:58:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30FE82845D for ; Wed, 28 Jun 2017 14:58:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 25EEC28571; Wed, 28 Jun 2017 14:58:56 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 BF4542845D for ; Wed, 28 Jun 2017 14:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751639AbdF1O5T (ORCPT ); Wed, 28 Jun 2017 10:57:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbdF1O5N (ORCPT ); Wed, 28 Jun 2017 10:57:13 -0400 Received: from localhost.localdomain (pub082136089155.dh-hfc.datazug.ch [82.136.89.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DA7D22BD6; Wed, 28 Jun 2017 14:57:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DA7D22BD6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=krzk@kernel.org From: Krzysztof Kozlowski To: "Rafael J. Wysocki" , Kevin Hilman , Ulf Hansson , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski Subject: [PATCH v3 7/8] PM / Domains: Add lockdep asserts for domains list mutex Date: Wed, 28 Jun 2017 16:56:22 +0200 Message-Id: <20170628145623.20716-8-krzk@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170628145623.20716-1-krzk@kernel.org> References: <20170628145623.20716-1-krzk@kernel.org> 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 Add lockdep checks for holding mutex protecting the list of domains. This might expose misuse even though only file-scope functions use it for now. Signed-off-by: Krzysztof Kozlowski --- 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 be34cbf3793e..1a47c5ff6a2f 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -726,6 +726,8 @@ static bool pm_genpd_present(const struct generic_pm_domain *genpd) { const struct generic_pm_domain *gpd; + lockdep_assert_held(&gpd_list_lock); + if (IS_ERR_OR_NULL(genpd)) return false; @@ -1321,6 +1323,8 @@ static int genpd_add_subdomain(struct generic_pm_domain *genpd, struct gpd_link *link, *itr; int ret = 0; + lockdep_assert_held(&gpd_list_lock); + if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain) || genpd == subdomain) return -EINVAL; @@ -1528,6 +1532,8 @@ static int genpd_remove(struct generic_pm_domain *genpd) { struct gpd_link *l, *link; + lockdep_assert_held(&gpd_list_lock); + if (IS_ERR_OR_NULL(genpd)) return -EINVAL;