FAILED: patch "[PATCH] watchdog: rtd119x: Avoid division by zero" failed to apply to 6.1-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 5af7d2cbd20f893def03c8310a460ade66a5d822
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092229-endowment-helpless-158e@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 5af7d2cbd20f893def03c8310a460ade66a5d822 Mon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <[email protected]>
Date: Sun, 13 Sep 2026 14:48:50 +0800
Subject: [PATCH] watchdog: rtd119x: Avoid division by zero
clk_get_rate() could return 0. Avoid a division by zero panic.
drivers/watchdog/rtd119x_wdt.c +6 -1
@@ -98,6 +98,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct rtd119x_watchdog_device *data; +unsigned long rate; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -111,10 +112,14 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)if (IS_ERR (data->clk))return PTR_ERR (data->clk); + rate =clk_get_rate (data->clk); +if (!rate) +return -EINVAL ; + data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout =120 ; - data->wdt_dev.max_timeout =0xffffffff /clk_get_rate (data->clk); + data->wdt_dev.max_timeout =0xffffffff / rate; data->wdt_dev.min_timeout =1 ; data->wdt_dev.parent = dev;
Sasha Levin
maintainerPATCH 1/2 watchdog: rtd119x: Use devm_clk_get_enabled() helper
From: Christophe JAILLET <[email protected]>
[ Upstream commit 6cc0768ba6f5293a4435612164a2cfbf2edbd025 ]
The devm_clk_get_enabled() helper:
- calls devm_clk_get()
- calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the need of a dedicated function used with devm_add_action_or_reset().
Stable-dep-of: 5af7d2cbd20f ("watchdog: rtd119x: Avoid division by zero")
--- drivers/watchdog/rtd119x_wdt.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/watchdog/rtd119x_wdt.c +1 -15
@@ -94,16 +94,10 @@ static const struct of_device_id rtd119x_wdt_dt_ids[] = { { } }; -static void rtd119x_clk_disable_unprepare (void *data) -{ -clk_disable_unprepare (data); -} -static int rtd119x_wdt_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;struct rtd119x_watchdog_device *data; -int ret; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -113,18 +107,10 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)if (IS_ERR (data->base))return PTR_ERR (data->base); - data->clk =devm_clk_get (dev,NULL ); + data->clk =devm_clk_get_enabled (dev,NULL );if (IS_ERR (data->clk))return PTR_ERR (data->clk); - ret =clk_prepare_enable (data->clk); -if (ret) -return ret; - ret =devm_add_action_or_reset (dev, rtd119x_clk_disable_unprepare, - data->clk); -if (ret) -return ret; - data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout =120 ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 watchdog: rtd119x: Avoid division by zero
From: Tzung-Bi Shih <[email protected]>
[ Upstream commit 5af7d2cbd20f893def03c8310a460ade66a5d822 ]
clk_get_rate() could return 0. Avoid a division by zero panic.
--- drivers/watchdog/rtd119x_wdt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/watchdog/rtd119x_wdt.c +6 -1
@@ -98,6 +98,7 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct rtd119x_watchdog_device *data; +unsigned long rate; data =devm_kzalloc (dev,sizeof (*data),GFP_KERNEL );if (!data)
@@ -111,10 +112,14 @@ static int rtd119x_wdt_probe(struct platform_device *pdev)if (IS_ERR (data->clk))return PTR_ERR (data->clk); + rate =clk_get_rate (data->clk); +if (!rate) +return -EINVAL ; + data->wdt_dev.info = &rtd119x_wdt_info; data->wdt_dev.ops = &rtd119x_wdt_ops; data->wdt_dev.timeout =120 ; - data->wdt_dev.max_timeout =0xffffffff /clk_get_rate (data->clk); + data->wdt_dev.max_timeout =0xffffffff / rate; data->wdt_dev.min_timeout =1 ; data->wdt_dev.parent = dev;
Signature · 1 line
2.53.0