From: Andy Shevchenko Date: Fri, 25 Jun 2021 15:37:33 +0000 (+0300) Subject: serial: max310x: Unprepare and disable clock in error path X-Git-Tag: howlett/maple/20220722_2~2615^2~8 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=61acabaae5ba58b3c32e6e90d24c2c0827fd27a8;p=users%2Fjedix%2Flinux-maple.git serial: max310x: Unprepare and disable clock in error path In one error case the clock may be left prepared and enabled. Unprepare and disable clock in that case to balance state of the hardware. Fixes: d4d6f03c4fb3 ("serial: max310x: Try to get crystal clock rate from property") Reported-by: Dan Carpenter Signed-off-by: Andy Shevchenko Link: https://lore.kernel.org/r/20210625153733.12911-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 0c1e4df522153..ef11860cd69e5 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c @@ -1293,7 +1293,8 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty freq = uartclk; if (freq == 0) { dev_err(dev, "Cannot get clock rate\n"); - return -EINVAL; + ret = -EINVAL; + goto out_clk; } if (xtal) {