From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753970AbcAEBTU (ORCPT ); Mon, 4 Jan 2016 20:19:20 -0500 Received: from domu-toccata.ens-lyon.fr ([140.77.166.138]:36300 "EHLO sonata.ens-lyon.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753688AbcAEBTQ (ORCPT ); Mon, 4 Jan 2016 20:19:16 -0500 X-Greylist: delayed 303 seconds by postgrey-1.27 at vger.kernel.org; Mon, 04 Jan 2016 20:19:15 EST Date: Tue, 5 Jan 2016 02:19:12 +0100 From: Samuel Thibault To: William Hubbs , Chris Brannon , Kirk Reiser , Melike Yurtoglu , Greg Kroah-Hartman , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH] Staging: speakup: Fix getting port information Message-ID: <20160105011912.GM3232@var.home> Mail-Followup-To: Samuel Thibault , William Hubbs , Chris Brannon , Kirk Reiser , Melike Yurtoglu , Greg Kroah-Hartman , speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch f79b0d9c223c ("staging: speakup: Fixed warning instead of ") broke the port information in the speakup driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included, and no other header includes asm/serial.h. We here make sure serialio.c does get the arch-specific definition of SERIAL_PORT_DFNS from asm/serial.h, if any. Along the way, this makes sure that we do have information for the requested serial port number (index) Signed-off-by: Samuel Thibault Fixes: f79b0d9c223c ("staging: speakup: Fixed warning instead of ") --- a/drivers/staging/speakup/serialio.c +++ b/drivers/staging/speakup/serialio.c @@ -6,6 +6,9 @@ #include "spk_priv.h" #include "serialio.h" +#include +#include + #ifndef SERIAL_PORT_DFNS #define SERIAL_PORT_DFNS #endif @@ -23,9 +26,15 @@ const struct old_serial_port *spk_serial int baud = 9600, quot = 0; unsigned int cval = 0; int cflag = CREAD | HUPCL | CLOCAL | B9600 | CS8; - const struct old_serial_port *ser = rs_table + index; + const struct old_serial_port *ser; int err; + if (index >= ARRAY_SIZE(rs_table)) { + pr_info("no port info for ttyS%d\n", index); + return NULL; + } + ser = rs_table + index; + /* Divisor, bytesize and parity */ quot = ser->baud_base / baud; cval = cflag & (CSIZE | CSTOPB);