From patchwork Mon Mar 14 01:51:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Ruirui X-Patchwork-Id: 86655 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B1DE3B6F7D for ; Mon, 14 Mar 2011 12:45:03 +1100 (EST) Received: from canuck.infradead.org ([134.117.69.58]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1Pywnj-0001jI-Vf; Mon, 14 Mar 2011 01:42:28 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1Pywnj-00050j-8H; Mon, 14 Mar 2011 01:42:27 +0000 Received: from ebb05.tieto.com ([131.207.168.36]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PywnO-00050J-UC for linux-mtd@lists.infradead.org; Mon, 14 Mar 2011 01:42:07 +0000 X-AuditID: 83cfa824-b7b21ae000000a96-2e-4d7d7268b653 Received: from FIVLA-EXHUB02.eu.tieto.com ( [131.207.136.42]) by ebb05.tieto.com (SMTP Mailer) with SMTP id 3A.F0.02710.8627D7D4; Mon, 14 Mar 2011 03:42:01 +0200 (EET) Received: from localhost (10.126.38.218) by inbound.tieto.com (131.207.136.49) with Microsoft SMTP Server id 8.3.106.1; Mon, 14 Mar 2011 03:41:59 +0200 Date: Mon, 14 Mar 2011 09:51:48 +0800 From: Yang Ruirui To: , , , , , Subject: [PATCH 02/02] force module loaded with partitions set Message-ID: <20110314015148.GA6827@darkstar> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: AAAAAA== X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110313_214207_147364_4C2AF2FF X-CRM114-Status: UNSURE ( 5.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [131.207.168.36 listed in list.dnswl.org] X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Yang Ruirui partitions can not be set after module loaded, the moduel param mode is 0444. this patch force module loaded with param partitions set, if user does not set partitions then give out a warning and return -EINVAL Signed-off-by: Yang Ruirui Tested-by: Shao Yanqing Tested-by: Xiao Yang --- drivers/mtd/mtdswap.c | 6 ++++++ 1 file changed, 6 insertions(+) --- mtd-2.6-fc2ff59.orig/drivers/mtd/mtdswap.c 2011-03-14 09:36:09.283329099 +0800 +++ mtd-2.6-fc2ff59/drivers/mtd/mtdswap.c 2011-03-14 09:46:30.229993534 +0800 @@ -1569,6 +1569,12 @@ static struct mtd_blktrans_ops mtdswap_o static int __init mtdswap_modinit(void) { + if (!partitions[0]) { + printk(KERN_WARNING + "Please load mtdswap with correct partitions param\n"); + return -EINVAL; + } + return register_mtd_blktrans(&mtdswap_ops); }