Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754646AbaGIVB5 (ORCPT ); Wed, 9 Jul 2014 17:01:57 -0400 Received: from mail-ob0-f169.google.com ([209.85.214.169]:38553 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbaGIVBz (ORCPT ); Wed, 9 Jul 2014 17:01:55 -0400 MIME-Version: 1.0 In-Reply-To: <53BD8398.6020507@codeaurora.org> References: <1404665232-14311-1-git-send-email-rickard_strandqvist@spectrumdigital.se> <53BD8398.6020507@codeaurora.org> Date: Wed, 9 Jul 2014 23:01:54 +0200 Message-ID: Subject: Re: [PATCH v2] tty: serial: msm_serial.c: Cleaning up uninitialized variables From: Rickard Strandqvist To: Stephen Boyd Cc: David Brown , Daniel Walker , Bryan Huntsman , Greg Kroah-Hartman , Jiri Slaby , Grant Likely , Rob Herring , linux-arm-msm@vger.kernel.org, linux-serial@vger.kernel.org, "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2014-07-09 20:02 GMT+02:00 Stephen Boyd : > On 07/06/14 09:47, Rickard Strandqvist wrote: >> Set reasonable initial value of some variables, in case >> they do not get set to something otherwise. >> And I've also added a plausibility control of the values. >> >> Signed-off-by: Rickard Strandqvist >> --- > > This patch doesn't look right... > >> @@ -930,17 +930,21 @@ static int __init msm_console_setup(struct console *co, char *options) >> >> msm_init_clock(port); >> >> - if (options) >> + if (options) { >> uart_parse_options(options, &baud, &parity, &bits, &flow); >> + if (baud < 300 || baud > 115200) >> + baud = 115200; >> + if (NULL == strchr("noeNOE", parity)) >> + parity = 'n'; >> + if (bits != 7) >> + bits = 8; >> + if (flow != 'r') >> + flow = 'n'; >> + } >> >> - bits = 8; >> - parity = 'n'; >> - flow = 'n'; >> msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE, >> UART_MR2); /* 8N1 */ >> > > because this code is overriding whatever is parsed from > uart_parse_options() on purpose. The hardware is configured for 8 bits, > no parity, no flow control with this msm_write() statement. Maybe we > should extend the code to configure the parity and flow control bits > instead. Hi Okay, well that explains the strange code. Maybe there should be a comment about this? You mean that UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE is set correctly for the msm_write function? I can do that... Regardless, the original error whas that baud could be used uninitialized. Kind regards Rickard Strandqvist -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/