From patchwork Tue Aug 2 23:38:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 108008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 69A7EB70FE for ; Wed, 3 Aug 2011 09:39:47 +1000 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QoOYg-0007Iw-TT; Tue, 02 Aug 2011 23:39:35 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QoOYg-0002yQ-DR; Tue, 02 Aug 2011 23:39:34 +0000 Received: from mms2.broadcom.com ([216.31.210.18]) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QoOYd-0002y7-47 for linux-mtd@lists.infradead.org; Tue, 02 Aug 2011 23:39:31 +0000 Received: from [10.9.200.133] by mms2.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.3.2)); Tue, 02 Aug 2011 16:44:34 -0700 X-Server-Uuid: D3C04415-6FA8-4F2C-93C1-920E106A2031 Received: from mail-irva-13.broadcom.com (10.11.16.103) by IRVEXCHHUB02.corp.ad.broadcom.com (10.9.200.133) with Microsoft SMTP Server id 8.2.247.2; Tue, 2 Aug 2011 16:39:02 -0700 Received: from localhost.localdomain (ld-irv-0074 [10.12.160.50]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 75A8F74D04; Tue, 2 Aug 2011 16:39:18 -0700 (PDT) From: "Brian Norris" To: "Artem Bityutskiy" Subject: [PATCH] mtd: cafe_nand: register master MTD at most once Date: Tue, 2 Aug 2011 16:38:30 -0700 Message-ID: <1312328310-18003-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: References: MIME-Version: 1.0 X-WSS-ID: 622654683W4946096-01-01 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110802_193931_387748_4476B945 X-CRM114-Status: GOOD ( 13.11 ) X-Spam-Score: 1.2 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) 0.0 DKIM_ADSP_CUSTOM_MED No valid author signature, adsp_override is CUSTOM_MED 1.2 NML_ADSP_CUSTOM_MED ADSP custom_med hit, and not from a mailing list Cc: dsd@laptop.org, Dmitry Eremin-Solenikov , linux-mtd@lists.infradead.org, Jamie Iles , Brian Norris , David Woodhouse 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 This patch addresses a regression where a master MTD object might be registered twice if no partitions are found. The initial bug report can be seen here: http://lists.infradead.org/pipermail/linux-mtd/2011-July/037086.html The regression is caused by: commit 0f7451bea72c64d3f0a47850328d52f0315e2ea6 "mtd: cafe_nand.c: use mtd_device_parse_register" The aforementioned commit was intended to basically just refactor the codebase; however, it had unintentional side effects. The cafe_nand probe behavior over time is as follows. Previous functionality (before commit 0f7451be): A) register the master device with add_mtd_device() B) if partitions are found, register them as well New functionality (at commit 0f7451be): A) register the master device with add_mtd_device() B) if partitions are found, register them as well C) if partitions are not found, register the master device (again) Correct functionality (this patch): (remove step A) B) if partitions are found, register them C) if partitions are not found, register the master device Thus, this fix means that we will never register both the master MTD and its partitions, as we did before commit 0f7451be. This is probably the expected behavior and should be a welcome change. Reported-by: Daniel Drake Signed-off-by: Brian Norris --- drivers/mtd/nand/cafe_nand.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 661e5dc..11a56df 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c @@ -797,9 +797,6 @@ static int __devinit cafe_nand_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, mtd); - /* We register the whole device first, separate from the partitions */ - mtd_device_register(mtd, NULL, 0); - mtd->name = "cafe_nand"; mtd_device_parse_register(mtd, part_probes, 0, NULL, 0);