Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2405272lqp; Sun, 24 Mar 2024 18:09:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWmkAVZK/TyXVCX5h6rt3b15TWL+TPD8L9+b0BmzYyq+MES1hK0Q4VNw+XYTb2X49odTKhe2VLP65N7tG0HN/K961G8lFaAIaLIaggT9g== X-Google-Smtp-Source: AGHT+IFib/pskj6Xg13YKa0Ml4UlajGwVuTyflhrx9Le55X9EIUO56CiiBdxu66nAMDJcdsDp7Rn X-Received: by 2002:a17:90a:f518:b0:29b:c34b:7e6b with SMTP id cs24-20020a17090af51800b0029bc34b7e6bmr3413409pjb.32.1711328980970; Sun, 24 Mar 2024 18:09:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711328980; cv=pass; d=google.com; s=arc-20160816; b=FM6G0C3IX//dUaNKOj33ilsewgoxbweM6UFFRXylYeILS5ov3Snt66GciSYN9i5pFH MUBz0VzjctL670K49wGtaLp+BjADELajPnA4mB9MsCRTstGT+Ue46Srcl7FwLyQyb8R5 oWLK4e3Ymhf/56ffY8fYG/ofbpuC9zMm6EGqQtjC7cz0MKaBbUg0lE7lynQ0IBXZ3rc0 kpYubU0zVWeHr9Hi7NHALd3TGFooKrfIxxO9GNfFn7PvIQPpcXumfr9ZvyFXLsmJrNgE YP/BXsUfZGpxz7Q0ZPbavTfEqzsDHe5wBe8YYe/1ijKl2tWm/aJyGv2RU8sbvt5I+29o 3hXw== 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:dkim-signature; bh=FOt6IGanROEPh2ymQ2TLLYUY1qCUDpD5XMYsm+5uv+4=; fh=9bNX7sMo2TDfjD9iWvzMsUASkbllB7DKFLbxWX4EYIQ=; b=QvvQRtNXVzSVjSrfO46jD3IWWYcBRznXNYoIYQsqlxQ8rVncKKXhRjYXF60sOve/6R vS2jonxefbnit5FEgLRCZcA7dHKDSgt62/g4hyDOpL+ngaKJ1Lhvh3i4Z+SfrpvmCB3Q 93WdioifBAP8FHDghY7pND/rn8TOBxVJo6VsN6SoS3p8M/8ndcObspA3tp2By5Km7Qqi cDZ6p6xbGcFqxK5xX59+VHhPpRRABzCxjtW/0XF5akJRIHzXsm7DZkxwLYtYpZ1TmNJ6 BgZOl2duleAl939kMyLukHrg7GXUFYqrdkZGN0iiyA+lok0uA9lWAAk6h1WSIvh8+7a2 koiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E7+d03Qb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id hg1-20020a17090b300100b0029c7229e554si6442166pjb.182.2024.03.24.18.09.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 18:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E7+d03Qb; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113472-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113472-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C5870B2526F for ; Mon, 25 Mar 2024 00:45:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 911C513BC34; Sun, 24 Mar 2024 22:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E7+d03Qb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CE8B13BC15; Sun, 24 Mar 2024 22:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320273; cv=none; b=AoSjxLoB5cJY9cH+cGCc4TohBnNPMmBipS91o6OHTOmyYhXm8yi3mMAhRFtIWkx08KBJGyJsj2fC9iq+hvaVfFINCGWURVMot9VHC0d2LxfHxRNDuw5OjdJ3H4XXGp/v8KXc1QQXjV8CDP1ryN7vlHZQ+DtXAS2rBjZqJ2jvXb0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711320273; c=relaxed/simple; bh=sxl+ayC5rApzaa/Of515A4BlBq7f+RoQ7f0vJHU1v70=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PNu6D0bDvtx2edeOhn++XM/ICEbV4ZWsxJu8EJBamq4EVb3AJgzK9VVTjb/0xRosGAhFoDNehYkgdL6cbUvydEEYcYL2GfWQFXGlpkXmnynIQLsexF11q1SKTv8vDg/nv336+zzrztHfZdseK6lP/+IxVuYrqIQayhabK+ywLh4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E7+d03Qb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 517D1C43394; Sun, 24 Mar 2024 22:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711320273; bh=sxl+ayC5rApzaa/Of515A4BlBq7f+RoQ7f0vJHU1v70=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7+d03Qb7NyggebL4eEXogvvv0VUNbs2XIpaB4gbJtUWndKiBrBsJ+Vuzxm0Rm9Bc +xPP0VxGkx/ufXjNCos3HTB+JRyUZeki27Bb4OeUzba7nlAAd7TBSIKgFPGxVIJamV U3FcZaUQfw02PvrqDLVPimaQg5GigoFsnSzm+2ENDnUw54bYEO/dSFzRy/OlVKUYUe 6i43KnTdHfp+LaVOvrMvyk2dfntGATLOARGSooOhpU66KlT+FIILf1u0sWLODyosQ2 V8g9dN4+Q4q65AbPlOM5ksQqjilm7uVBeN+F0ZmenSQOctUw43WigofUPBBxZtuJXA strKBXN+5GJvQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ji Sheng Teoh , Xingyu Wu , Ley Foon Tan , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 6.8 581/715] watchdog: starfive: Check pm_runtime_enabled() before decrementing usage counter Date: Sun, 24 Mar 2024 18:32:40 -0400 Message-ID: <20240324223455.1342824-582-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ji Sheng Teoh [ Upstream commit 8bc22a2f1bf0f402029087fcb53130233a544fed ] In the probe function, pm_runtime_put_sync() will fail on platform with runtime PM disabled. Check if runtime PM is enabled before calling pm_runtime_put_sync() to fix it. Fixes: db728ea9c7be ("drivers: watchdog: Add StarFive Watchdog driver") Signed-off-by: Xingyu Wu Signed-off-by: Ley Foon Tan Signed-off-by: Ji Sheng Teoh Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20240119082722.1133024-1-jisheng.teoh@starfivetech.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin --- drivers/watchdog/starfive-wdt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c index e28ead24c520e..df68ae4acbd7e 100644 --- a/drivers/watchdog/starfive-wdt.c +++ b/drivers/watchdog/starfive-wdt.c @@ -494,8 +494,13 @@ static int starfive_wdt_probe(struct platform_device *pdev) if (ret) goto err_exit; - if (!early_enable) - pm_runtime_put_sync(&pdev->dev); + if (!early_enable) { + if (pm_runtime_enabled(&pdev->dev)) { + ret = pm_runtime_put_sync(&pdev->dev); + if (ret) + goto err_exit; + } + } return 0; -- 2.43.0