From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758171AbdEVJ3i (ORCPT ); Mon, 22 May 2017 05:29:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:51233 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757923AbdEVJ3e (ORCPT ); Mon, 22 May 2017 05:29:34 -0400 From: Rui Teng To: Greg Kroah-Hartman Cc: speakup@linux-speakup.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Rui Teng Subject: [PATCH] drivers/staging/speakup: fix some coding style problem in spk_ttyio.c Date: Sun, 21 May 2017 02:43:47 +0800 X-Mailer: git-send-email 2.11.0 X-TM-AS-GCONF: 00 x-cbid: 17052209-0056-0000-0000-0000036C12AC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007101; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00863930; UDB=6.00428819; IPR=6.00643710; BA=6.00005364; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015536; XFM=3.00000015; UTC=2017-05-22 09:29:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17052209-0057-0000-0000-000007A24477 Message-Id: <20170520184347.3870-1-rui.teng@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-05-22_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1705220050 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a patch to the spk_ttyio.c file which fixes up the problems reported by the checkpatch.pl tool. Signed-off-by: Rui Teng --- drivers/staging/speakup/spk_ttyio.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/staging/speakup/spk_ttyio.c b/drivers/staging/speakup/spk_ttyio.c index 6e0f042f6a44..791da6e6d6ed 100644 --- a/drivers/staging/speakup/spk_ttyio.c +++ b/drivers/staging/speakup/spk_ttyio.c @@ -25,10 +25,8 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty) speakup_tty = tty; ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL); - if (!ldisc_data) { - pr_err("speakup: Failed to allocate ldisc_data.\n"); + if (!ldisc_data) return -ENOMEM; - } sema_init(&ldisc_data->sem, 0); ldisc_data->buf_free = true; @@ -50,6 +48,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty, if (spk_ttyio_synth->read_buff_add) { int i; + for (i = 0; i < count; i++) spk_ttyio_synth->read_buff_add(cp[i]); @@ -61,7 +60,8 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty, return 0; /* Make sure the consumer has read buf before we have seen - * buf_free == true and overwrite buf */ + * buf_free == true and overwrite buf + */ mb(); ldisc_data->buf = cp[0]; @@ -162,6 +162,7 @@ static int spk_ttyio_out(struct spk_synth *in_synth, const char ch) { if (in_synth->alive && speakup_tty && speakup_tty->ops->write) { int ret = speakup_tty->ops->write(speakup_tty, &ch, 1); + if (ret == 0) /* No room */ return 0; @@ -204,7 +205,8 @@ static unsigned char ttyio_in(int timeout) rv = ldisc_data->buf; /* Make sure we have read buf before we set buf_free to let - * the producer overwrite it */ + * the producer overwrite it + */ mb(); ldisc_data->buf_free = true; /* Let TTY push more characters */ -- 2.11.0