From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E52DACE7A95 for ; Mon, 25 Sep 2023 14:59:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229584AbjIYO7v convert rfc822-to-8bit (ORCPT ); Mon, 25 Sep 2023 10:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232434AbjIYO7k (ORCPT ); Mon, 25 Sep 2023 10:59:40 -0400 Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72734101 for ; Mon, 25 Sep 2023 07:59:33 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id 2B679635DB44; Mon, 25 Sep 2023 16:59:32 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 2CG2CtXr0tWR; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id AF815635DB53; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IIRgHpfaaJM8; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 8A104635DB44; Mon, 25 Sep 2023 16:59:31 +0200 (CEST) Date: Mon, 25 Sep 2023 16:59:31 +0200 (CEST) From: Richard Weinberger To: Miquel Raynal Cc: ZhaoLong Wang , Vignesh Raghavendra , linux-mtd , linux-kernel , chengzhihao1 , yi zhang , yangerkun Message-ID: <488305749.81257.1695653971403.JavaMail.zimbra@nod.at> In-Reply-To: <20230925163727.7ecebe9a@xps-13> References: <20230923005856.2538223-1-wangzhaolong1@huawei.com> <1131184426.81026.1695650583370.JavaMail.zimbra@nod.at> <20230925163727.7ecebe9a@xps-13> Subject: Re: [RFC] mtd: Fix error code loss in mtdchar_read() function. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF97 (Linux)/8.8.12_GA_3809) Thread-Topic: Fix error code loss in mtdchar_read() function. Thread-Index: OEbc/pJ3ZpcGhIHTGpc8YMoVo8AlzQ== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Ursprüngliche Mail ----- > Von: "Miquel Raynal" >> Given this a second thought. I don't think a NAND driver is allowed to return >> less than requests bytes and setting EBADMSG. >> UBI's IO path has a comment on that: >> >> /* >> * The driver should never return -EBADMSG if it failed to read >> * all the requested data. But some buggy drivers might do >> * this, so we change it to -EIO. >> */ >> if (read != len && mtd_is_eccerr(err)) { >> ubi_assert(0); >> err = -EIO; >> } > > Interesting. Shall we add this check to the mtd_read() path as well? > > Maybe with a WARN_ON()? WARN_ON_ONCE(), please. But yes, let's add it. Thanks, //richard