Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1256227rdh; Mon, 25 Sep 2023 07:34:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgXpzyTolDxFHwq5wKo1gZXD8zVcJTVPQ6S8t3f0qH6lbUs7NUuHqWWlbWnCjdTYdZjcrF X-Received: by 2002:a05:6a20:9756:b0:14d:9bd1:6361 with SMTP id hs22-20020a056a20975600b0014d9bd16361mr4665886pzc.11.1695652490463; Mon, 25 Sep 2023 07:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695652490; cv=none; d=google.com; s=arc-20160816; b=wgN5ezq+uoGyMHVK711e6gMI6+JtaATxZE6m4heBJWkreaQfOx5oHMbScUBHdyHA2h RwJRz8TMzwKQTEKcGUSAvm9c2rlJEwLIbjXysFYZPqkLQkZ3mA3PeFwr1F8v73bsAJfN QJEtNGVsppqrBVv79XhwuwViHyA0pgPXWWol1+Y3b9p6uRwILFfGwA6stkKY//HA8qex E/0gH2lQ2yrEBuF9505NcT9qzgNF1/DDy0VDgvXtV2/vvsMFMGdWXrAvGw9GDzyMSVuY EMX1hshdG/1+n0o1YFis2R4V/owctrotZJBWyk4aknyASbBKySWJQrxCrK8VzBF135US hYOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=TwbW2t+gfYV9Iq/V8MLX5T505eKc89PgKfmv3WcvCM4=; fh=DOOMfWrRUXbBnRI2yPAd37TyPa9M+vCOsgr9HaSd0BQ=; b=Yx/DskMNKMbe1nkEYolCzhOfSczBBr+wEfUrA3gydC3nze4NvT8o8mjWQw5TKvuNV0 0TBQ/hH9A8IsXDkbpAJSBHoXAZMSK1QFdywMdCub0s5yy4Nw72FjSCVP4AfpJJUxfUDT xqX4nsSJVGpxzZnAz5tbK2lfCCG7GFdDojSr387u3hDtVUu+vGoa/OtXzJtK66OKs8Hm xQ+g4JMox1UeSKkMw3tl5LdmRaz5K2icvVjFrp3n42NCJJSBNXzZHuofAJp+O/fCvB6s JfL/lehYzVt+SzgqJiMuIGI/tLgnZ7LlgJ2TDtO+8LG0itvb5gmvu8A9ow93zaoYKMF8 b6Pg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id j11-20020a170902da8b00b001c62139b164si1595979plx.38.2023.09.25.07.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 07:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id C1F1280236CC; Mon, 25 Sep 2023 07:22:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231160AbjIYOWX (ORCPT + 99 others); Mon, 25 Sep 2023 10:22:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjIYOWW (ORCPT ); Mon, 25 Sep 2023 10:22:22 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B47C7B6 for ; Mon, 25 Sep 2023 07:22:15 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4RvQ2m3Cs5zNnfR; Mon, 25 Sep 2023 22:18:24 +0800 (CST) Received: from [10.174.178.209] (10.174.178.209) by dggpemm500009.china.huawei.com (7.185.36.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 25 Sep 2023 22:22:12 +0800 Message-ID: Date: Mon, 25 Sep 2023 22:22:12 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [RFC] mtd: Fix error code loss in mtdchar_read() function. To: Miquel Raynal CC: , , , , , , References: <20230923005856.2538223-1-wangzhaolong1@huawei.com> <20230925104938.3f7b4284@xps-13> From: ZhaoLong Wang In-Reply-To: <20230925104938.3f7b4284@xps-13> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.209] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 07:22:24 -0700 (PDT) > There is this comment right above, and I'm not sure it is still up to > date because I believe many drivers just don't provide the data upon > ECC error: After observing the nand_base framework code, I think the current nand_base framework can limit the length of retlen to 0 when an ECC error occurs. The prerequisite is that the NAND driver development personnel can correctly provide the return value of the function according to the requirements of the chip->ecc.read_page() callback. However, the read_page() callback comment does not notice the particularity of the following two error codes: * -EUCLEAN - Returned by the MTD layer when maxbitflips greater then bitflip_threshold * -EBADMSG - Returned by NAND Generic Layer when the statistical ECC error stats                          changes and the number of retries is exhausted. These two error codes are handled by the upper layer and should not be returned by the NAND driver developer. But some driver developers don't realize this. So I don't think it's worth fixing right now, but is the description of the return value of the callback too simplistic? Is there any other more detailed description document for reference?