Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2257896iof; Wed, 8 Jun 2022 00:39:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnSOnlWUaCi1Vi11OdaQ+5+ebAN4LqsPFkZ1W//q4yg3kYhp+d0nXncRmyzB8uc3AH9T+J X-Received: by 2002:aa7:9103:0:b0:519:3150:6b3f with SMTP id 3-20020aa79103000000b0051931506b3fmr33374867pfh.67.1654673947409; Wed, 08 Jun 2022 00:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654673947; cv=none; d=google.com; s=arc-20160816; b=kXW7DYFzgxV2sCC2H0lSHOqHWEyKb5tB4V8q3S+gG1zPdvbbq/anV4h4ixltJdP6+F gb1IPXzWdUO7vcpUnGJYMwyO+fW+vswJMhg2A5U0uPqwMC8lnJMrX20mfqZEOcZcBBA4 DyN/lJM6qlWOTkmMmuQp5njeRwh7nWjHhOxHf56H3XpuV8zcPGWFoM8hmqVriyIWBaNY Pgzp24l645N0zVrm/rzvAVB5nc8N9PpP8inlnqz8L+fRYVMGcwttvYFjtFewpra5qTYw lkfAjiZeYRGfUIRG8fNbAcOIpieDHx9wpzwLLsTz5OLT1zKjjgOadaI4HxapYum2Yxo5 3+Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=m8dZ94UaaJpxmOLHD6hW7jINCaMyaWQk9HRRpaegbOE=; b=JHraORfdeTOgvWem/qCnz2m+0s0r7Rr4TBqMOT2RaQWD2/G/kdotpaARyJFc3Wj4ey ppPs6NW16Ogbq7RinKKySvCmFKKcUIqlK0H72KMYS7ayj+oPcdRQjWNAEjMhUBg91knx f7BczaIh1gzggzuA8cCnxvj0XSAY7DfSyuQqYlYZbj3SnLhPKezvTEEluzN5GiBM9HKG wXtXMb3X21bsCUpcpZguXiQ1dGMyHUJXRnAgNl66ughngHjSq2xsqTisKnlJ1hZQP5WN X6wlHRCm5etn8nAIcoBt+msryxfV66T0xPd1tYl4366Lbs5/J2sODUhZse8C7el54yt8 nCDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S87ANvnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s7-20020a17090302c700b00163ed1483a6si25331663plk.428.2022.06.08.00.38.40; Wed, 08 Jun 2022 00:39:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=S87ANvnJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382191AbiFGWkA (ORCPT + 99 others); Tue, 7 Jun 2022 18:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379070AbiFGVZL (ORCPT ); Tue, 7 Jun 2022 17:25:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45CF9227CFB; Tue, 7 Jun 2022 12:01:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6F41617CC; Tue, 7 Jun 2022 19:01:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA949C385A2; Tue, 7 Jun 2022 19:01:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628487; bh=+tuo2CRgp+QVPGwPvewXtMmsI8rHSTGcq5AMWNkynzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S87ANvnJpIDEvhi0sPwEubYmdvViMZAFnYhYhhGIqKpLelV1E+ZvgjJiDhSAOJU8j gUKcftrNsp1MimqcaUa6TSnk+MzuwTu4AtoO0d2JoesAnR0POtiJyoFOwoiQuiL55U lGtVdlrY0Ng2ZtdQ0gA3P6kKm2b19r2kQsPklBd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Ezequiel Garcia , Miquel Raynal , Sasha Levin Subject: [PATCH 5.18 347/879] mtdblock: warn if opened on NAND Date: Tue, 7 Jun 2022 18:57:45 +0200 Message-Id: <20220607165012.932889479@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bjørn Mork [ Upstream commit 96a3295c351da82d7af99b2fc004a3cf9f4716a9 ] Warning on every translated mtd partition results in excessive log noise if this driver is loaded: nand: device found, Manufacturer ID: 0xc2, Chip ID: 0xf1 nand: Macronix MX30LF1G18AC nand: 128 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64 mt7621-nand 1e003000.nand: ECC strength adjusted to 4 bits read_bbt: found bbt at block 1023 10 fixed-partitions partitions found on MTD device mt7621-nand Creating 10 MTD partitions on "mt7621-nand": 0x000000000000-0x000000080000 : "Bootloader" mtdblock: MTD device 'Bootloader' is NAND, please consider using UBI block devices instead. 0x000000080000-0x000000100000 : "Config" mtdblock: MTD device 'Config' is NAND, please consider using UBI block devices instead. 0x000000100000-0x000000140000 : "Factory" mtdblock: MTD device 'Factory' is NAND, please consider using UBI block devices instead. 0x000000140000-0x000002000000 : "Kernel" mtdblock: MTD device 'Kernel' is NAND, please consider using UBI block devices instead. 0x000000540000-0x000002000000 : "ubi" mtdblock: MTD device 'ubi' is NAND, please consider using UBI block devices instead. 0x000002140000-0x000004000000 : "Kernel2" mtdblock: MTD device 'Kernel2' is NAND, please consider using UBI block devices instead. 0x000004000000-0x000004100000 : "wwan" mtdblock: MTD device 'wwan' is NAND, please consider using UBI block devices instead. 0x000004100000-0x000005100000 : "data" mtdblock: MTD device 'data' is NAND, please consider using UBI block devices instead. 0x000005100000-0x000005200000 : "rom-d" mtdblock: MTD device 'rom-d' is NAND, please consider using UBI block devices instead. 0x000005200000-0x000005280000 : "reserve" mtdblock: MTD device 'reserve' is NAND, please consider using UBI block devices instead. mtk_soc_eth 1e100000.ethernet eth0: mediatek frame engine at 0xbe100000, irq 21 This is more likely to annoy than to help users of embedded distros where this driver is enabled by default. Making the blockdevs available does not imply that they are in use, and warning about bootloader partitions or other devices which obviously never will be mounted is more confusing than helpful. Move the warning to open(), where it will be of more use - actually warning anyone who mounts a file system on NAND using mtdblock. Fixes: e07403a8c6be ("mtdblock: Warn if added for a NAND device") Signed-off-by: Bjørn Mork Reviewed-by: Ezequiel Garcia Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220328161108.87757-1-bjorn@mork.no Signed-off-by: Sasha Levin --- drivers/mtd/mtdblock.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c index 03e3de3a5d79..1e94e7d10b8b 100644 --- a/drivers/mtd/mtdblock.c +++ b/drivers/mtd/mtdblock.c @@ -257,6 +257,10 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd) return 0; } + if (mtd_type_is_nand(mbd->mtd)) + pr_warn("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n", + mbd->tr->name, mbd->mtd->name); + /* OK, it's not open. Create cache info for it */ mtdblk->count = 1; mutex_init(&mtdblk->cache_mutex); @@ -322,10 +326,6 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) if (!(mtd->flags & MTD_WRITEABLE)) dev->mbd.readonly = 1; - if (mtd_type_is_nand(mtd)) - pr_warn("%s: MTD device '%s' is NAND, please consider using UBI block devices instead.\n", - tr->name, mtd->name); - if (add_mtd_blktrans_dev(&dev->mbd)) kfree(dev); } -- 2.35.1