From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Richardson Subject: Re: [PATCH v2 1/2] Input: touchscreen-iproc: Add Broadcom iProc touchscreen driver Date: Fri, 19 Dec 2014 15:03:20 -0800 Message-ID: <5494AEB8.8060606@broadcom.com> References: <1419027470-7969-1-git-send-email-jonathar@broadcom.com> <1419027470-7969-2-git-send-email-jonathar@broadcom.com> <1419028015.25129.14.camel@perches.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-gw1-out.broadcom.com ([216.31.210.62]:15875 "EHLO mail-gw1-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462AbaLSXDX (ORCPT ); Fri, 19 Dec 2014 18:03:23 -0500 In-Reply-To: <1419028015.25129.14.camel@perches.com> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Joe Perches Cc: Dmitry Torokhov , Grant Likely , Rob Herring , Ray Jui , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org On 14-12-19 02:26 PM, Joe Perches wrote: > On Fri, 2014-12-19 at 14:17 -0800, Jonathan Richardson wrote: >> Add initial version of the Broadcom touchscreen driver. > > more trivia: > >> diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c > [] >> +static int get_tsc_config(struct device_node *np, struct iproc_ts_priv *priv) >> +{ >> + u32 val; > [] >> + if (of_property_read_u32(np, "debounce_timeout", &val) >= 0) { >> + if (val < 0 || val > 255) { >> + dev_err(dev, "debounce_timeout must be [0-255]\n"); >> + return -EINVAL; >> + } >> + priv->cfg_params.debounce_timeout = val; > > Doesn't the compiler generate a warning message > about an impossible "unsigned < 0" test for all > of these "val < 0" uses? > Actually no it doesn't. The gcc output shows that neither -Wtype-limits nor -Wextra are used to compile that file. I assume this is because there would be just too many warnings. >> + } >> + >> + if (of_property_read_u32(np, "settling_timeout", &val) >= 0) { >> + if (val < 0 || val > 11) { > [] >> + if (of_property_read_u32(np, "touch_timeout", &val) >= 0) { >> + if (val < 0 || val > 255) { > [] >> + if (of_property_read_u32(np, "average_data", &val) >= 0) { >> + if (val < 0 || val > 8) { > [] >> + if (of_property_read_u32(np, "fifo_threshold", &val) >= 0) { >> + if (val < 0 || val > 31) { > >