* [PATCH] serial: sc16is7xx: Fix clock leak on invalid clock frequency
@ 2026-10-30 8:55 laixiangwu
2026-10-30 8:57 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: laixiangwu @ 2026-10-30 8:55 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-kernel, linux-serial, laixiangwu
sc16is7xx_probe() enables the clock with clk_prepare_enable() early in
the probe path. If the resulting clock frequency cannot be determined
(neither from the clock itself, nor from the "clock-frequency" property
or platform data), the driver bails out with -EINVAL, but it does so
with a plain return, leaving the clock prepared and enabled.
All the later error paths of the probe already jump to the out_clk
label to disable the clock. Do the same here.
Fixes: cb1b206cff46 ("serial: sc16is7xx: Use devm_clk_get_optional()")
Signed-off-by: laixiangwu <laixiangwu@cmss.chinamobile.com>
---
drivers/tty/serial/sc16is7xx.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index fba588559..e464c6d72 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1619,10 +1619,12 @@ int sc16is7xx_probe(struct device *dev, const struct sc16is7xx_devtype *devtype,
freq = uartclk;
if (pfreq)
freq = *pfreq;
- if (freq)
+ if (freq) {
dev_dbg(dev, "Clock frequency: %luHz\n", freq);
- else
- return -EINVAL;
+ } else {
+ ret = -EINVAL;
+ goto out_clk;
+ }
}
s->devtype = devtype;
--
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: sc16is7xx: Fix clock leak on invalid clock frequency
2026-10-30 8:55 [PATCH] serial: sc16is7xx: Fix clock leak on invalid clock frequency laixiangwu
@ 2026-10-30 8:57 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-30 8:57 UTC (permalink / raw)
To: laixiangwu; +Cc: linux-serial
> sc16is7xx_probe() enables the clock with clk_prepare_enable() early in
> the probe path. If the resulting clock frequency cannot be determined
> (neither from the clock itself, nor from the "clock-frequency" property
> or platform data), the driver bails out with -EINVAL, but it does so
> with a plain return, leaving the clock prepared and enabled.
>
> All the later error paths of the probe already jump to the out_clk
> label to disable the clock. Do the same here.
>
> Fixes: cb1b206cff46 ("serial: sc16is7xx: Use devm_clk_get_optional()")
> Signed-off-by: laixiangwu <laixiangwu@cmss.chinamobile.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261030085508.1882-1-laixiangwu@cmss.chinamobile.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-30 8:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 8:55 [PATCH] serial: sc16is7xx: Fix clock leak on invalid clock frequency laixiangwu
2026-10-30 8:57 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.