From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932569AbdCVU5j (ORCPT ); Wed, 22 Mar 2017 16:57:39 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:50198 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932208AbdCVU5c (ORCPT ); Wed, 22 Mar 2017 16:57:32 -0400 Date: Wed, 22 Mar 2017 21:57:28 +0100 From: Boris Brezillon To: Masahiro Yamada Cc: linux-mtd@lists.infradead.org, laurent.monat@idquantique.com, thorsten.christiansson@idquantique.com, Enrico Jorns , Jason Roberts , Artem Bityutskiy , Dinh Nguyen , Marek Vasut , Brian Norris , Graham Moore , David Woodhouse , Masami Hiramatsu , Chuanxiao Dong , Jassi Brar , linux-kernel@vger.kernel.org, Richard Weinberger , Cyrille Pitchen Subject: Re: [PATCH v2 11/53] mtd: nand: denali: fix bitflips calculation in handle_ecc() Message-ID: <20170322215728.69e8b566@bbrezillon> In-Reply-To: <1490191680-14481-12-git-send-email-yamada.masahiro@socionext.com> References: <1490191680-14481-1-git-send-email-yamada.masahiro@socionext.com> <1490191680-14481-12-git-send-email-yamada.masahiro@socionext.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; 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 On Wed, 22 Mar 2017 23:07:18 +0900 Masahiro Yamada wrote: > + do { > + err_addr = ioread32(denali->flash_reg + ECC_ERROR_ADDRESS); > + err_sector = ECC_SECTOR(err_addr); > + err_byte = ECC_BYTE(err_addr); > + > + err_cor_info = ioread32(denali->flash_reg + ERR_CORRECTION_INFO); > + err_cor_value = ECC_CORRECTION_VALUE(err_cor_info); > + err_device = ECC_ERR_DEVICE(err_cor_info); > + > + /* reset the bitflip counter when crossing ECC sector */ > + if (err_sector != prev_sector) > + bitflips = 0; > + > + if (ECC_ERROR_UNCORRECTABLE(err_cor_info)) { > + /* > + * if the error is not correctable, need to look at the > + * page to see if it is an erased page. if so, then > + * it's not a real ECC error > + */ > + ret = -EBADMSG; You should never return -EBADMSG directly. Just increment ecc_stats.failed and let the core return -EBADMSG to the upper layer.