From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757511AbcFHQrX (ORCPT ); Wed, 8 Jun 2016 12:47:23 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33150 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754678AbcFHQrU (ORCPT ); Wed, 8 Jun 2016 12:47:20 -0400 Subject: Re: [PATCH] serial_core: Change UART PM state to OFF on failure To: Pramod Gurav References: <1462527983-32108-1-git-send-email-pramod.gurav@linaro.org> Cc: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org From: Peter Hurley Message-ID: <57584C10.5090300@hurleysoftware.com> Date: Wed, 8 Jun 2016 09:47:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1462527983-32108-1-git-send-email-pramod.gurav@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Pramod, On 05/06/2016 02:46 AM, Pramod Gurav wrote: > uart_change_pm is used to turn on the UART controller resources and > change UART's PM status. On failure to allocate pages the controller > be left in ON state. This will change the state to OFF on failure. > > Signed-off-by: Pramod Gurav > --- > drivers/tty/serial/serial_core.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c > index 62fe368..58af2e9 100644 > --- a/drivers/tty/serial/serial_core.c > +++ b/drivers/tty/serial/serial_core.c > @@ -156,9 +156,10 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, > if (!state->xmit.buf) { > /* This is protected by the per port mutex */ > page = get_zeroed_page(GFP_KERNEL); > - if (!page) > + if (!page) { if (!uart_console(uport)) Otherwise, you'll be powering off the console. Just out of curiosity, did you actually hit this error? Regards, Peter Hurley > + uart_change_pm(state, UART_PM_STATE_OFF); > return -ENOMEM; > - > + } > state->xmit.buf = (unsigned char *) page; > uart_circ_clear(&state->xmit); > } >