From nobody Tue Feb 10 07:40:33 2026 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 331ACEB64DD for ; Tue, 18 Jul 2023 08:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232106AbjGRIyf (ORCPT ); Tue, 18 Jul 2023 04:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231812AbjGRIyR (ORCPT ); Tue, 18 Jul 2023 04:54:17 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B186E6F for ; Tue, 18 Jul 2023 01:54:16 -0700 (PDT) Received: from dggpemm500009.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R4t503sJqzVjbd; Tue, 18 Jul 2023 16:52:52 +0800 (CST) Received: from huawei.com (10.175.127.227) 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.27; Tue, 18 Jul 2023 16:54:14 +0800 From: ZhaoLong Wang To: , , CC: , , , , Subject: [PATCH V2 5/5] mtd: Add several functions to the fail_function list Date: Tue, 18 Jul 2023 16:51:19 +0800 Message-ID: <20230718085119.3885747-6-wangzhaolong1@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230718085119.3885747-1-wangzhaolong1@huawei.com> References: <20230718085119.3885747-1-wangzhaolong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500009.china.huawei.com (7.185.36.225) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" add mtd_read(), mtd_write(), mtd_erase(), mtd_block_markbad() to fail_function list for testing purpose Signed-off-by: ZhaoLong Wang --- drivers/mtd/mtdcore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index e00b12aa5ec9..ecf1c5e68479 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -30,6 +30,7 @@ #include #include #include +#include =20 #include #include @@ -1396,6 +1397,7 @@ int mtd_erase(struct mtd_info *mtd, struct erase_info= *instr) return ret; } EXPORT_SYMBOL_GPL(mtd_erase); +ALLOW_ERROR_INJECTION(mtd_erase, ERRNO); =20 /* * This stuff for eXecute-In-Place. phys is optional and may be set to NUL= L. @@ -1493,6 +1495,7 @@ int mtd_read(struct mtd_info *mtd, loff_t from, size_= t len, size_t *retlen, return ret; } EXPORT_SYMBOL_GPL(mtd_read); +ALLOW_ERROR_INJECTION(mtd_read, ERRNO); =20 int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, const u_char *buf) @@ -1509,6 +1512,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t= len, size_t *retlen, return ret; } EXPORT_SYMBOL_GPL(mtd_write); +ALLOW_ERROR_INJECTION(mtd_write, ERRNO); =20 /* * In blackbox flight recorder like scenarios we want to make successful w= rites @@ -2329,7 +2333,7 @@ int mtd_block_markbad(struct mtd_info *mtd, loff_t of= s) return 0; } EXPORT_SYMBOL_GPL(mtd_block_markbad); - +ALLOW_ERROR_INJECTION(mtd_block_markbad, ERRNO); /* * default_mtd_writev - the default writev method * @mtd: mtd device description object pointer --=20 2.31.1