From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753763AbbJBRhY (ORCPT ); Fri, 2 Oct 2015 13:37:24 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:32931 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752541AbbJBRhS (ORCPT ); Fri, 2 Oct 2015 13:37:18 -0400 Date: Fri, 2 Oct 2015 10:37:14 -0700 From: Dmitry Torokhov To: cpaul@redhat.com Cc: David Herrmann , linux-kernel , linux-input@vger.kernel.org, linux-api@vger.kernel.org, Andrew Morton , Mauro Carvalho Chehab , Greg KH , Arnd Bergmann , Joe Perches , Jiri Slaby , Vishnu Patekar , Sebastian Ott , Benjamin Tissoires , Hans de Goede , linux-doc@vger.kernel.org Subject: Re: [PATCH v6.1 1/1] Input: Add userio module Message-ID: <20151002173714.GA8437@dtor-ws> References: <1443030589-27574-1-git-send-email-cpaul@redhat.com> <1443030899-28737-1-git-send-email-cpaul@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1443030899-28737-1-git-send-email-cpaul@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2015 at 01:54:59PM -0400, cpaul@redhat.com wrote: > +static int userio_device_write(struct serio *id, unsigned char val) > +{ > + struct userio_device *userio = id->port_data; > + unsigned long flags; > + > + if (!userio) > + return -1; I still have the same question: how can this happen? Where do we reset port data to NULL? What happens if we set to NULL after checking? > + > + spin_lock_irqsave(&userio->buf_lock, flags); > + > + userio->buf[userio->head] = val; > + userio->head = (userio->head + 1) % USERIO_BUFSIZE; > + > + if (userio->head == userio->tail) > + dev_warn(userio_misc.this_device, > + "Buffer overflowed, userio client isn't keeping up"); > + > + spin_unlock_irqrestore(&userio->buf_lock, flags); > + > + wake_up_interruptible(&userio->waitq); > + > + return 0; > +} Thanks. -- Dmitry