Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795980867; b=dTHYL/LdHsTxusMwjBp2tIdeWS/Gifnz8Tgo4KHuet2yI4TwDJswlI1fiTuChCke7/aw ZaXutLqziFonkcvl5tTIMVbiPxwF18YHEmOOWsvcIkEIx/T4GieB7fuKaZC6nS6mbZZSo 2BRX+gDS95LUjrTSNVuYGUcE8sh26YO7L5lHVOt+JyBWhFNNKkorW9DJ4nSmd+ES3APj7 ESJfaJwNtNh56OPsdlPclPobw0g+2jhEqDjuh06RNk2OET5K67b8hOijDngCviTRpyX+B EAT/W52QX54qQitUrEDuqiBzIKyVMhW8KKSVmCaLJdpCXnHAmDqP6QVy9Opi1WYeJtQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795980867; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=zlP8NyPOSycYtqYIZj9Ww1I5tCDCEsiuoa9IPmH1yFg=; b=wFmybX+CTnlOoVpOcqvDbn86/LmwcgN7rU2MWgXRFiMqeEB38jij1arvylREevIuU8vy lmKXtUfoZUGUjk7okjyB+waccPyNPClf3W+wsTI/NL1tL4eV7oijh1jd54MEB/8fyOmgV KPRpqbkHEprdb6wulTZimESj+NWGLUQKfGXylHRuP4R3WE0iT66YovE4n+ulQBfWwh3Dn ZKC3S2Rq3U3HNllkPNMAFuNkeDeDNnueO4acj3Y0XA3ZjU2ukBFjmlkHepR35+zbl7NpZ hbndNLObS5K5/eCNkdQvhWa6jRVzXiNHhPhaxNgwEVA+nf7GG89kGotY5YHg8hjBiFQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ROLkM74I; arc=none smtp.remote-ip=209.85.167.41 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D9B7606A323 for ; Sun, 29 Nov 2026 19:34:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6D9B7606A323 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.a=rsa-sha256 header.s=20260707 header.b=ROLkM74I Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5c17ef1e18cso6308172e87.0 for ; Sun, 29 Nov 2026 11:34:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795980865; x=1796585665; darn=vger.kernel.org; h=mime-version:content-transfer-encoding:content-type:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=zlP8NyPOSycYtqYIZj9Ww1I5tCDCEsiuoa9IPmH1yFg=; b=ROLkM74ILfNiPof9ZZH8eF/N29TgcseX8tikN2zD7oRK+3HY+SoMtzciV8VGZj1X4T f7qH+2ReuK3azhRCXHVShAV0GnPK+oYh9O2CtJiv44uWPoekJFipgRVO12HAQ4eU7hxx fDDXeI9f5+9drQ+6oihhnU6HyMfjUS0YhmBZVLgqa3rIlH0UxgoabUsuWwSbS3D7SOMQ sIyjZide6NnzSW4qucszE+iwAJRzCcyEqafZnGkCh87nxfx8i1y9nMfBI6LqUdzZvSG2 /IkisVpKlifyOumfBkxDZKvfhIcqpH2h8IeHqur+lwFcaQFgp4P4Mbpc5nRa7o625Cxd 5jbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795980865; x=1796585665; h=mime-version:content-transfer-encoding:content-type: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=zlP8NyPOSycYtqYIZj9Ww1I5tCDCEsiuoa9IPmH1yFg=; b=SvfCsFJLdC7XBc6ryI5P74ff1/p+oqoTcvDHwLJjEILQEAbpOIwS3w9WKPw2O/BZTy wrz3YDVKP1vgyfLbqnZkdFc30Z9q5RvsntmcIUGFq53T0D9hm4JzdUbvyenDDEpmMLYy b/Aq8fOQ6vIvTjW3UoIQro36WmZ54PpBrfU9ZsAT09NO4GhY2CK4WMbVRnKg2nG3CgXd OuOIkS6CpO+bZ7xmVzEL0fv2MQDii+CDUu13jGSQJq6ZGErCf+k4WOxeTwPmHpdLqTkw 5y1QqoquJY7FjZLa4ySyf/g8HHKAfVi7T2iMIvwvoE8uCLbtId3JTx8C3aHEF6sp3UJP xGgQ== X-Gm-Message-State: APuU4Z8hp9cDOJEK63czau0wmx9a8c8EXeiY079z8lf0Re5LZDWxVsZ1 vvuq9NKvQYqWlsdQDfhqzUQXbN3KRUZhQPZdXFzIAhu4mWa5/s06S/YD X-Gm-Gg: AZFdTZeMBDR/vSfOCdZqyU0bDib3V3ZElYWFWqrDoHjAIXLz34d1N5LjhTz+vOURU2L h1a/2U7//LV9nznF7OF9/sPTt2ytWfYIZ02Py5bzdZ9QOBVg+WRX9wDOQ5BAJC1A4zGRdgd/LvV t5xV8TVibZMcc5BCm84rS667CAVXcbcR6xt7y/opciSfAH+ekWr2VvD+csoi1RfhdePiAyoByEE QWptFbKvmBO1FN+4y8+jLM/RXt4e7w2YDb4uczuB1ArLizXv5AqGhuRC7d8an3xD6B/kfiU1PoQ O9x3hclfTOTva+ejhPITLbbt1p8FZ4RK5cA6BQsuzd1WM7SzBw5Sa/sStS7PB0X3Bdj6QaAUjHN keuGoLA0ayJUb7untjFHnL8qUMhiiO/cLwxAu8WkUzfusXuBEMX7fTslPAVTdiSpsLGNt2SARFJ e7ZsQofRzBpaHywDfyXvTLUkeBCtlo4K69J3GZxhDLJEyOqGNNAOFvtBfmXbzQDBhMwAEeF6u+9 9doXUGF0YvHDSrKtdoKWhsN5i8vuXE24UZ4nP0n+XpjIT/hNB1BIbuP+Iml/u/IMWOX8l9t9MHx N/SMOb0TWi3EA5thxuhJaguRzkxCrg== X-Received: by 2002:a05:6512:6682:10b0:5c1:c3b6:49ca with SMTP id 2adb3069b0e04-5c1c3b64b13mr5758838e87.42.1795980864525; Sun, 29 Nov 2026 11:34:24 -0800 (PST) Received: from [127.0.1.1] ([5.195.0.150]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c1bd043420sm7561895e87.57.2026.11.29.11.34.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 11:34:23 -0800 (PST) From: Jiawen Liu To: Biju Das , William Breathitt Gray Cc: linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH] counter: rz-mtu3-cnt: Abort probe if clock enable fails Date: Sun, 29 Nov 2026 19:25:33 +0000 Message-ID: <179598033975.2.6271980880185966626.pattern-ext-107.15@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 When the RZ/G2L MTU3 module clock has no active enable reference, clk_prepare_enable() can reach the CPG gate callback and return -ETIMEDOUT if the gate fails to report enabled. rz_mtu3_cnt_probe() ignores the error, marks the device runtime-active, and registers the Counter. Later Counter operations can access registers while the clock may still be off. Probe error handling or runtime suspend can also release a clock reference the probe never acquired. Return the error through dev_err_probe() before setting up runtime PM or registering the Counter. clk_prepare_enable() rolls back the prepare reference on enable failure, so only errors after a successful enable need the existing clock cleanup. Verification included source review, an arm64 RZ/G2L driver object build, git diff --check, and checkpatch. Runtime and hardware reproduction were not performed. Fixes: 0be8907359df ("counter: Add Renesas RZ/G2L MTU3a counter driver") Signed-off-by: Jiawen Liu --- drivers/counter/rz-mtu3-cnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/counter/rz-mtu3-cnt.c b/drivers/counter/rz-mtu3-cnt.c index 7bfb6979193ce..c8050ccb7ae98 100644 --- a/drivers/counter/rz-mtu3-cnt.c +++ b/drivers/counter/rz-mtu3-cnt.c @@ -861,7 +861,10 @@ static int rz_mtu3_cnt_probe(struct platform_device *pdev) mutex_init(&priv->lock); platform_set_drvdata(pdev, priv->clk); - clk_prepare_enable(priv->clk); + ret = clk_prepare_enable(priv->clk); + if (ret) + return dev_err_probe(dev, ret, "Clock enable failed\n"); + pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); ret = devm_add_action_or_reset(&pdev->dev, rz_mtu3_cnt_pm_disable, dev); -- 2.34.1