From nobody Fri Aug 14 15:49:51 2026 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09BC44749DD for ; Fri, 14 Aug 2026 13:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714905; cv=none; b=kHVftt0qozkNyW/ZMWc9AefXgxhpxtqWM3hLAn5cDLAyYBXZtMAfnSTcNeSwtXlSo9i1IngH7adpI81V2CJj2GXZ00FWN2EPEdbT6nOmbq8yEoE8M9yFEapWRKQS1IMHWg54GfU+2eRestimMMWrRhZRwJwws/P6SMrR5w9uDII= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786714905; c=relaxed/simple; bh=gFgCDtaDhkHUy5zlzen5RjHhMrQ/5qm6YfwQtHm+KaM=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cpRep08+y6WIIq5TGnRHzagkgaL9dwqkjCoaa5HDQnHXdqTaoNEANos8cesUVVWkZnQ+JdxRkwiEUz79/UQjCloE36bVxzxuh5qpKRdjIBkmUvfF/YbmEIVlSFNYG3o4tiBXW4U0jB/RxSE/snkDfu+T/YSmj2I5EkeoLKETr/M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=r5f7i46n; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r5f7i46n" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-2d004f135b1so13414645ad.3 for ; Fri, 14 Aug 2026 06:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786714903; x=1787319703; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=AW/kAhpxk6iwgmshFSjwEkP45x3FFpydZgKHFvSyQTQ=; b=r5f7i46ngDcdZiNETABSXzFfZwTfRROE5Nv2iIOw3tOMZ+6x4A4N5Xf9DUdqFIAxkY b9ONMZcrSfkZmI1eb4w04SAYaKFiluv99bJ+3LSD3tyMZf0At/LtXNww1wxv+jybLywE cSamRgB01lrVWWm60MOq6+5PY0Thds/+fYrZx2A8osAPKkkqCACQtTl97VPEYrwE0YX/ fdCgDC9KCSdIUa9OmS2Kbh/d+lx2SuBjdxWVRILpfGmDpuvlZLGGCxyO3JM8v1HgWlyG GH68BK25zHGXnUY1pyNt9SBmhNwFWY4i9oKl/JCTRr4Q4xTFzPx/sqfvVoWTeQZj4QF7 jizw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786714903; x=1787319703; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=AW/kAhpxk6iwgmshFSjwEkP45x3FFpydZgKHFvSyQTQ=; b=UzEia8dAMqzkTitscKmUlBkXrsotmjwDLiD6Uwjbb2osO2nBlGB6BP5N16XuJcOVPP CTJVvL4ZHK9eqsD+Zab5y637FQPRPrlsEh3jn/yS8v86iHndb0aMDo2MdVNCfxEeCybv p69KJxEb2kpYhchfLvjfziAv5yY5LH/qsECmJz/mIGHCwJKwI+BUcZ1TTuniSNNcDt7/ HblYjXuhPAk0ECijS1rDMJIgM41f7O/WDIQYFflmLqo+/ZsjGjFEfYOyV+UsQhZJ6hGi BtNuOhreJU6859PVmax2p2KDRISLi+ZTZCLpxfuFRKGA+BOXc1uY22ZJLSkw/U8JW/zm vBtA== X-Forwarded-Encrypted: i=1; AHgh+RqQ3KIPtuyW4Z1/KLwfqlP8nRKn5nprmxl5RRxzsASBmZLNum8DtbPraCbZDPzqOSY9oiCs1CZpnxyNu3o=@vger.kernel.org X-Gm-Message-State: AOJu0YzRvON0qMj2UFbN3bCmvrnu6SU9SdnWoXFLe0Fdua0tT0a25Hva LKuXHHvKaJ+sUsToZ6jpzSNzvz16DMyi0g4iyVBR7shaaPVUEOchmVJY X-Gm-Gg: AR+sD12r5SP092/VVofWFII8veC2g0IOn9HNQdKodvc4HlAdxphOSE/AgqpCSI4NAzy XWIDT1LrDnOzZLzKglTlBIBS9pv/AtT/EAle6VXG8T9AGemcYK1c8zjr0TBmUp8nvgeDGj8ONNM mr6NzNAX+Kbf6fnXvGfYRac+o8lD8a5vKMjQxlBNQf0b6rxNoql+CrwEloLIZZxqtf2tQhwwutw 3bHbyEem9XuRqcMs30Ubf1MOOS+u+5QFAhpaoDVY7BOgra55uZs6SDoFie5LpO3+5TwGA5HoFRz yao/hdo3BSS73u9O3Dx/0lFu0cnGIfwKct804VagcdR5ifLNk8WvudZTBd28LK6n255F9ti1VAt B8XK5sm5TJDGtcRONb50FRnIgYxPUPdo3YpTkxZX25wS17S/QsCtT5kUDhUH6kQs0fW9H4E4XeB 6wR0WjVwjw84gQphHc/cOuY5FASn/UUcKYPGEjbKgXYjBDKPGxvo08kDf28lQ0/p11Zu9ubri28 KRUNwYn X-Received: by 2002:a17:903:37c7:b0:2c7:f2c6:89e0 with SMTP id d9443c01a7336-2d3b08053b6mr72682355ad.4.1786714903174; Fri, 14 Aug 2026 06:41:43 -0700 (PDT) Received: from haichao.tail057a43.ts.net ([2001:da8:e000:1206:e9af:7c0e:be31:2c3f]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2d3ae7c067asm10269255ad.28.2026.08.14.06.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2026 06:41:42 -0700 (PDT) From: Ruoyu Wang To: Biju Das , William Breathitt Gray , Lee Jones Cc: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Ruoyu Wang Subject: [PATCH] counter: rz-mtu3-cnt: Balance runtime PM on enable failure Date: Fri, 14 Aug 2026 21:41:38 +0800 Message-ID: <20260814134138.1388045-1-ruoyuw560@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" rz_mtu3_count_enable_write() used pm_runtime_get_sync() without checking its return value before initializing a counter. A failed runtime resume was therefore ignored and the callback continued with the device unavailable. Use pm_runtime_resume_and_get() and return a failed resume to the Counter core. Keep the matching put when shared-channel initialization fails after a successful resume, and leave the cached enable state unchanged. This issue was found by a static analysis checker and confirmed by manual source review. Fixes: 0be8907359df ("counter: Add Renesas RZ/G2L MTU3a counter driver") Signed-off-by: Ruoyu Wang --- drivers/counter/rz-mtu3-cnt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c index 7bfb6979193ce..a8ba8ebed236d 100644 --- a/drivers/counter/rz-mtu3-cnt.c +++ b/drivers/counter/rz-mtu3-cnt.c @@ -504,9 +504,14 @@ static int rz_mtu3_count_enable_write(struct counter_d= evice *counter, goto exit; =20 if (enable) { - pm_runtime_get_sync(counter->parent); + ret =3D pm_runtime_resume_and_get(counter->parent); + if (ret < 0) + goto exit; + ret =3D rz_mtu3_initialize_counter(counter, count->id); - if (ret =3D=3D 0) + if (ret) + pm_runtime_put(counter->parent); + else priv->count_is_enabled[count->id] =3D true; } else { rz_mtu3_terminate_counter(counter, count->id); --=20 2.51.0