From patchwork Wed Feb 8 19:24:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Kleine-Budde X-Patchwork-Id: 140195 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (unknown [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 26BC1B71B2 for ; Thu, 9 Feb 2012 06:27:05 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1RvD8v-0002hO-7f; Wed, 08 Feb 2012 19:25:25 +0000 Received: from bombadil.infradead.org ([2001:4830:2446:ff00:4687:fcff:fea6:5117]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RvD8X-0002eq-4I for linux-mtd@merlin.infradead.org; Wed, 08 Feb 2012 19:25:01 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RvD8R-0007dt-TR for linux-mtd@lists.infradead.org; Wed, 08 Feb 2012 19:25:00 +0000 Received: from gallifrey.ext.pengutronix.de ([2001:6f8:1178:4:5054:ff:fe8d:eefb] helo=hardanger.do.blackshift.org) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1RvD8C-0006bj-Ay; Wed, 08 Feb 2012 20:24:40 +0100 From: Marc Kleine-Budde To: linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mtd: ixp4xx: oops in ixp4xx_flash_probe Date: Wed, 8 Feb 2012 20:24:29 +0100 Message-Id: <1328729069-21308-3-git-send-email-mkl@blackshift.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1328729069-21308-1-git-send-email-mkl@blackshift.org> References: <1328729069-21308-1-git-send-email-mkl@blackshift.org> X-SA-Exim-Connect-IP: 2001:6f8:1178:4:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@blackshift.org X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-mtd@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20120208_142456_418006_67A00398 X-CRM114-Status: GOOD ( 15.32 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 TVD_SUBJ_NUM_OBFU_MINFP TVD_SUBJ_NUM_OBFU_MINFP Cc: Marc Kleine-Budde , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In commit "c797533 mtd: abstract last MTD partition parser argument" the third argument of "mtd_device_parse_register()" changed from start address of the MTD device to a pointer to a struct. The "ixp4xx_flash_probe()" function was not converted properly, causing this oops during boot: Searching for RedBoot partition table in IXP4XX-Flash.0 at offset 0x7e0000 Unable to handle kernel paging request at virtual address 50000000 pgd = c0004000 [50000000] *pgd=00000000 Internal error: Oops: f5 [#1] CPU: 0 Not tainted (3.2.5-00002-gc809cb2 #4) PC is at parse_redboot_partitions+0x400/0x5b0 LR is at parse_redboot_partitions+0x3e0/0x5b0 pc : [] lr : [] psr: 20000013 sp : c0829de4 ip : c0829de4 fp : c0829e3c r10: c180d000 r9 : 00000000 r8 : 00000008 r7 : 00000200 r6 : 50000000 r5 : 00000000 r4 : c0888c00 r3 : c0944400 r2 : 00000000 r1 : c02c6060 r0 : 00000007 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 000039ff Table: 00004000 DAC: 00000017 Process swapper (pid: 1, stack limit = 0xc0828260) Stack: (0xc0829de4 to 0xc082a000) 9de0: c0829e0c c182d000 c0179a08 c0944400 00000048 00000000 00000000 9e00: 00020000 c0829e70 c180d000 00020000 00000000 00000000 c028ba40 c028ba18 9e20: c028be88 50000000 c024b250 c0888c00 c0829e6c c0829e40 c0162f58 c0163ef8 9e40: c0829e70 00000000 00000000 c0888c00 00000000 00000000 00000000 00000000 9e60: c0829e90 c0829e70 c015ffac c0162ed8 c09418a0 c09418a0 c027cc28 c027cedc 9e80: 00000000 c0829eb4 c0829e94 c017a464 c015ff90 00000000 c027cc30 c02a2568 9ea0: c027cc30 c028be48 c0829ec4 c0829eb8 c01338c4 c017a318 c0829ee8 c0829ec8 9ec0: c01323b4 c01338b4 c027cc30 c028be48 c027cc64 00000000 00000000 c0829f04 9ee0: c0829eec c013254c c0132338 c028be48 c0829f08 c01324b8 c0829f2c c0829f08 9f00: c0131ba0 c01324c4 c08240f8 c083fbd0 c028be48 c028a4ac c0941840 00000000 9f20: c0829f3c c0829f30 c0132218 c0131b40 c0829f68 c0829f40 c01314c0 c0132204 9f40: c0236120 c02765cc c028be48 c026d95c 00000013 00000000 00000000 c0829f88 9f60: c0829f6c c0132b90 c013134c c02765cc 00000000 c026d95c 00000013 c0829f98 9f80: c0829f8c c0133d28 c0132b1c c0829fa8 c0829f9c c026d970 c0133ce8 c0829fdc 9fa0: c0829fac c025d270 c026d968 c028271c c0023c94 00000013 c02765cc c02766bc 9fc0: c0023c94 00000013 00000000 00000000 c0829ff4 c0829fe0 c025d400 c025d1d8 9fe0: 00000000 c025d380 00000000 c0829ff8 c0023c94 c025d38c 62737507 6f74735f Backtrace: [] (parse_redboot_partitions+0x0/0x5b0) from [] (parse_mtd_partitions+0x8c/0xdc) [] (parse_mtd_partitions+0x0/0xdc) from [] (mtd_device_parse_register+0x28/0xc8) [] (mtd_device_parse_register+0x0/0xc8) from [] (ixp4xx_flash_probe+0x158/0x1dc) r7:00000000 r6:c027cedc r5:c027cc28 r4:c09418a0 [] (ixp4xx_flash_probe+0x0/0x1dc) from [] (platform_drv_probe+0x1c/0x20) r7:c028be48 r6:c027cc30 r5:c02a2568 r4:c027cc30 [] (platform_drv_probe+0x0/0x20) from [] (driver_probe_device+0x88/0x18c) [] (driver_probe_device+0x0/0x18c) from [] (__driver_attach+0x94/0x98) r8:00000000 r7:00000000 r6:c027cc64 r5:c028be48 r4:c027cc30 [] (__driver_attach+0x0/0x98) from [] (bus_for_each_dev+0x6c/0x94) r6:c01324b8 r5:c0829f08 r4:c028be48 [] (bus_for_each_dev+0x0/0x94) from [] (driver_attach+0x20/0x28) r7:00000000 r6:c0941840 r5:c028a4ac r4:c028be48 [] (driver_attach+0x0/0x28) from [] (bus_add_driver+0x180/0x25c) [] (bus_add_driver+0x0/0x25c) from [] (driver_register+0x80/0x13c) [] (driver_register+0x0/0x13c) from [] (platform_driver_register+0x4c/0x60) r7:00000013 r6:c026d95c r5:00000000 r4:c02765cc [] (platform_driver_register+0x0/0x60) from [] (ixp4xx_flash_init+0x14/0x1c) [] (ixp4xx_flash_init+0x0/0x1c) from [] (do_one_initcall+0xa4/0x17c) [] (do_one_initcall+0x0/0x17c) from [] (kernel_init+0x80/0x124) r9:00000000 r8:00000000 r7:00000013 r6:c0023c94 r5:c02766bc r4:c02765cc [] (kernel_init+0x0/0x124) from [] (do_exit+0x0/0x694) r5:c025d380 r4:00000000 Code: 0a000028 e3560000 e583a000 0a00001f (e5962000) ---[ end trace bf1eac11c431d0ba ]--- This patch fixes the problem by filling the needed information into a "struct mtd_part_parser_data" and passing it to "mtd_device_parse_register()". Cc: linux-mtd@lists.infradead.org Signed-off-by: Marc Kleine-Budde --- drivers/mtd/maps/ixp4xx.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 8b54101..e864fc6 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c @@ -182,6 +182,9 @@ static int ixp4xx_flash_probe(struct platform_device *dev) { struct flash_platform_data *plat = dev->dev.platform_data; struct ixp4xx_flash_info *info; + struct mtd_part_parser_data ppdata = { + .origin = dev->resource->start, + }; int err = -1; if (!plat) @@ -247,7 +250,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev) /* Use the fast version */ info->map.write = ixp4xx_write16; - err = mtd_device_parse_register(info->mtd, probes, dev->resource->start, + err = mtd_device_parse_register(info->mtd, probes, &ppdata, plat->parts, plat->nr_parts); if (err) { printk(KERN_ERR "Could not parse partitions\n");