Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753233AbbD3U65 (ORCPT ); Thu, 30 Apr 2015 16:58:57 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:48175 "EHLO mail-out.m-online.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752907AbbD3U6a (ORCPT ); Thu, 30 Apr 2015 16:58:30 -0400 X-Auth-Info: coLQVF1gI/VCMt1r1hSw6CaN2HQ+vXaaieV//1N7iwY= From: Marek Vasut To: Michal Suchanek Subject: Re: [PATCH 1/3] MTD: m25p80: fix write return value. Date: Thu, 30 Apr 2015 20:43:11 +0200 User-Agent: KMail/1.13.7 (Linux/3.13-trunk-amd64; KDE/4.13.1; x86_64; ; ) Cc: linux-sunxi@googlegroups.com, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , David Woodhouse , Brian Norris , Huang Shijie , " =?utf-8?q?Rafa=C5=82?= =?utf-8?q?_Mi=C5=82ecki?=" , Ben Hutchings , Alison Chaiken , Mika Westerberg , "Bean Huo =?utf-8?q?=E9=9C=8D=E6=96=8C=E6=96=8C?= \(beanhuo\)" , "grmoore@altera.com" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org References: <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach@gmail.com> In-Reply-To: <55132b4496e7fe73f949186c0f140f3e4fd4e2c7.1430403750.git.hramrach@gmail.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201504302043.11118.marex@denx.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1467 Lines: 42 On Thursday, April 30, 2015 at 03:33:47 PM, Michal Suchanek wrote: > The size of written data was added to user supplied value rather than > written at the provided address. You might want to work on the commit message a little, something like the following, but feel free to reword as seen fit. The 'retlen' points to a variable representing the number of data bytes written/read (see include/linux/mtd/mtd.h) by the current invocation of the function. This variable must be set, not incremented. Otherwise, the patch is correct I believe: Acked-by: Marek Vasut > Signed-off-by: Michal Suchanek > --- > drivers/mtd/devices/m25p80.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c > index 7c8b169..0b2bc21 100644 > --- a/drivers/mtd/devices/m25p80.c > +++ b/drivers/mtd/devices/m25p80.c > @@ -102,7 +102,7 @@ static void m25p80_write(struct spi_nor *nor, loff_t > to, size_t len, > > spi_sync(spi, &m); > > - *retlen += m.actual_length - cmd_sz; > + *retlen = m.actual_length - cmd_sz; > } > > static inline unsigned int m25p80_rx_nbits(struct spi_nor *nor) Best regards, Marek Vasut -- 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/