Linux Serial subsystem development
 help / color / mirror / Atom feed
From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: "linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Shawn Guo" <shawnguo@kernel.org>, "Marek Vasut" <marex@denx.de>,
	"Fabio Estevam" <festevam@denx.de>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"NXP Linux Team" <linux-imx@nxp.com>,
	"Sergey Organov" <sorganov@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Rob Herring" <robh@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Tom Rix" <trix@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: RE: [PATCH] serial: imx: Ensure that imx_uart_rs485_config() is called with enabled clock
Date: Sun, 24 Dec 2023 12:53:14 +0000	[thread overview]
Message-ID: <149f4e1020954e2e91fe1cde0e4afebc@dh-electronics.com> (raw)
In-Reply-To: <20231224123254.GA15377@wunner.de>

From: Lukas Wunner [mailto:lukas@wunner.de]
Sent: Sunday, December 24, 2023 1:33 PM
> On Fri, Dec 22, 2023 at 11:11:01PM +0100, Christoph Niedermaier wrote:
>> There are register accesses in the function imx_uart_rs485_config(). The
>> clock must be enabled for these accesses. This was ensured by calling it
>> via the function uart_rs485_config() in the probe() function within the
>> range where the clock is enabled. With the commit 7c7f9bc986e6 ("serial:
>> Deassert Transmit Enable on probe in driver-specific way") it was removed
>> from the probe() function and is now only called through the function
>> uart_add_one_port() which is located at the end of the probe() function.
>> But the clock is already switched off in this area. To ensure that the
>> clock is enabled during register access, move the disabling of the clock
>> to the very end of the probe() function.
> 
> Thanks for catching this and sorry for the breakage.
> 
> 
>> @@ -2467,7 +2465,11 @@ static int imx_uart_probe(struct platform_device *pdev)
>>
>>       platform_set_drvdata(pdev, sport);
>>
>> -     return uart_add_one_port(&imx_uart_uart_driver, &sport->port);
>> +     ret = uart_add_one_port(&imx_uart_uart_driver, &sport->port);
>> +
>> +     clk_disable_unprepare(sport->clk_ipg);
>> +
>> +     return ret;
>>  }
> 
> There are a bunch of return statements in the "if (txirq > 0) ... else"
> clause a little further up.  You need to add a goto label in front of
> the "clk_disable_unprepare()" and change the return statements to gotos
> to avoid leaking enabled clocks in those error paths.

You are right. I overlooked that.
I will fix that in version 2.
 

Thanks and Regards
Christoph

      reply	other threads:[~2023-12-24 12:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 22:11 [PATCH] serial: imx: Ensure that imx_uart_rs485_config() is called with enabled clock Christoph Niedermaier
2023-12-24 12:32 ` Lukas Wunner
2023-12-24 12:53   ` Christoph Niedermaier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=149f4e1020954e2e91fe1cde0e4afebc@dh-electronics.com \
    --to=cniedermaier@dh-electronics.com \
    --cc=festevam@denx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jirislaby@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=marex@denx.de \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=sorganov@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=trix@redhat.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox