Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp960243lql; Tue, 12 Mar 2024 03:24:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUbxjkcktNEVyv4AVmi6EkZMXmeuMCvaZ/ElaqicszB9XlFN45Eu94NGTf9twzfP2jqotTPzzGbMNw7gU5rEdKkglYUQXWTAgKftNVAiQ== X-Google-Smtp-Source: AGHT+IFZ5qLzT0yUoOkwiUWDpYRTFGiYfsqudr+soSIpRgcpD32YI0Rl3UeqYyF/MT87e6Ybrzho X-Received: by 2002:ad4:584a:0:b0:690:c7d2:cc0c with SMTP id de10-20020ad4584a000000b00690c7d2cc0cmr8085011qvb.53.1710239044383; Tue, 12 Mar 2024 03:24:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710239044; cv=pass; d=google.com; s=arc-20160816; b=P/WPsOzlhkX0NNP3wri2ZuYEsJ4Tx+W+wfR2qIoDh7Bgu68+lW71k/qQYuvf7tESzG 3K9hmgpzQg3wFba15YM4kQdm0xv4XOq9wSk+cGupHr3NQCgcZGaY74J8GUmilm/tmiM/ rfneMhyY9zxK/zMk/8fRulCz7PDRjiBOWm5/n5NZE2KtIJdSZz3MwexNIHOmap6dTcQ+ ylFhkmU8qd9YHjD/jYQaZvRw5EJ8GOZfM2/vim8oc2F5klMWCVw17FA8MWJiholewxeb pz3BuRoLd9+M3tIE6e3Tx7AVvo4ytmEc+UW/UrdV2gUbZZB1U7g57KXns/N/O9I0sLOA 3XIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=oyA8jSsxFPzG/J/CUNnu9Q35E9ArcvrAu36BQm9l6HM=; fh=Ve3FBKFNYuN9a2kLR4CVDWk9WsPfmS1fLiG/J19ZIic=; b=VgHhpz41RiKz4EUOAFwADkmfEhQdILj6hmndmKTqqBRmjYHou48y2tCXnCGFA2GId9 jG+pYKkqWrt5qsoSVzeuZ8dp1Hkrnry2r6//bkXJcSTpyg5BrRDSUWgGZlHvwG5AmbPY 0jUXC7sE0J7j/2fzTDCBHQeMGt/AEZSRmTHxxnJexo8grmACdTkWANcKkWHqbUy9qC0/ J4FgKa1mZEcrJjyT+BqNoE2/IdrULgoqSC8mU7QQXBsn5LaudneCg2RAAFoQIT68sdRM CuGQvMqvIT/AFmN/aLHZgHXlWE6QEhaoEuxV+JmcyHDEjUaj1sPeA+DKmnkArGPC3/6e 3D7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-100104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 14-20020a056214202e00b0068cc019bafesi7317261qvf.396.2024.03.12.03.24.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 03:24:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-100104-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100104-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1D9161C212D4 for ; Tue, 12 Mar 2024 10:24:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4385379949; Tue, 12 Mar 2024 10:23:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CE5E5AD53; Tue, 12 Mar 2024 10:23:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710239022; cv=none; b=EHnSvxNXJS1TmB1/NyCNHCphayeafGprGTaPWmterkmVIrbb2b8fURy7/I4uepIO9Lo9+I7OuJGFxAyM22bHZGfC/5IfQM0ctzbqFa7iUxK5nWBcD2K6sNX9oJ7vNXWRk2s1NiFeHxYdxtNLZFrbPuMDdJwiCRDfrXar6CUxnqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710239022; c=relaxed/simple; bh=KwfhyoWqVtNfejQX5OWX8JcdEe04vFs6xiI5GVCF60s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=obZlks42fLKRWllAhL8ASFhwGETpOIYIX1ry5Gpy3nqpm2sjyVtoxe1wEA6PHw3am3I72S/uGl8plJ0msMqCHEvyGmxxyHGpcVsMUaHHZJNKNIr3o25Onye67Wa+GadB53rgpeaHpVMR+dRIccVVcV55AqgVxfPrV9FvNj/jtIE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3E6141570; Tue, 12 Mar 2024 03:24:17 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.52.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 69E5F3F73F; Tue, 12 Mar 2024 03:23:34 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org, suzuki.poulose@arm.com Cc: Anshuman Khandual , Lorenzo Pieralisi , Sudeep Holla , Mike Leach , James Clark , Maxime Coquelin , Alexandre Torgue , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-stm32@st-md-mailman.stormreply.com, Hanjun Guo , "Rafael J. Wysocki" , Len Brown , Leo Yan Subject: [PATCH V6 01/11] coresight: etm4x: Fix unbalanced pm_runtime_enable() Date: Tue, 12 Mar 2024 15:53:08 +0530 Message-Id: <20240312102318.2285165-2-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240312102318.2285165-1-anshuman.khandual@arm.com> References: <20240312102318.2285165-1-anshuman.khandual@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev() when etm4_probe() fails. This problem can be observed via the coresight etm4 module's (load -> unload -> load) sequence when etm4_probe() fails in etm4_probe_platform_dev(). [ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable! [ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable! [ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable! [ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable! [ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable! [ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable! [ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable! [ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable! This fixes the above problem - with an explicit pm_runtime_disable() call when etm4_probe() fails during etm4_probe_platform_dev(). Cc: Lorenzo Pieralisi Cc: Hanjun Guo Cc: Sudeep Holla Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Suzuki K Poulose Cc: Mike Leach Cc: James Clark Cc: Leo Yan Cc: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: coresight@lists.linaro.org Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices") Reviewed-by: James Clark Signed-off-by: Anshuman Khandual --- drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index c2ca4a02dfce..06a9b94b8c13 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -2213,6 +2213,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) ret = etm4_probe(&pdev->dev); pm_runtime_put(&pdev->dev); + if (ret) + pm_runtime_disable(&pdev->dev); + return ret; } -- 2.25.1