Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932095AbbLASTn (ORCPT ); Tue, 1 Dec 2015 13:19:43 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:33563 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756358AbbLASTk (ORCPT ); Tue, 1 Dec 2015 13:19:40 -0500 Date: Tue, 1 Dec 2015 10:19:36 -0800 From: Joshua Clayton To: Alexandre Belloni Cc: Alessandro Zummo , rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/9] rtc-pcf2123: clean up writes to the rtc chip Message-ID: <20151201101936.596e0186@jclayton-pc> In-Reply-To: <20151124221626.GE3950@piout.net> References: <813a6fe306c384c59418495605236927b9d00940.1446587705.git.stillcompiling@gmail.com> <20151124221626.GE3950@piout.net> X-Mailer: Claws Mail 3.12.0 (GTK+ 2.24.28; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 896 Lines: 25 On Tue, 24 Nov 2015 23:16:26 +0100 Alexandre Belloni wrote: > On 04/11/2015 at 07:36:34 -0800, Joshua Clayton wrote : > > +static int pcf2123_write(struct device *dev, u8 *txbuf, size_t > > size) +{ > > + struct spi_device *spi = to_spi_device(dev); > > + int ret; > > + > > + if (txbuf[0] > PCF2123_REG_MAX) > > + return -EFAULT; > > + > > Is that test really necessary? From what I understand the driver > always controls which register is written. > In the larger context of the driver, you are correct, there is no way for an out of range request unless someone were to add new code. I can remove it. -- 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/