From patchwork Mon Nov 17 19:37:17 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brownell X-Patchwork-Id: 9233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@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 EE1C9474C2 for ; Tue, 18 Nov 2008 08:14:14 +1100 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1L2BOQ-00013r-Gq; Mon, 17 Nov 2008 21:12:22 +0000 Received: from smtp120.sbc.mail.sp1.yahoo.com ([69.147.64.93]) by bombadil.infradead.org with smtp (Exim 4.68 #1 (Red Hat Linux)) id 1L2BOK-0000zo-NM for linux-mtd@lists.infradead.org; Mon, 17 Nov 2008 21:12:17 +0000 Received: (qmail 86012 invoked from network); 17 Nov 2008 21:12:15 -0000 Received: from unknown (HELO pogo.local) (david-b@69.226.222.107 with plain) by smtp120.sbc.mail.sp1.yahoo.com with SMTP; 17 Nov 2008 21:12:14 -0000 X-YMail-OSG: jBJrFMMVM1mry3IgY6LixHnvqs9bVDb4mweWAuOKxdmeI4X8_NVcr.PlOb66DKZKh31grtPf9hbCpBNfZTJQKSzdW1wMpSNtRqskcPHU7rRlC.lQu.4.xhoGMRzi2XnyZdZg91EKeea4pxfAIVf1Rk_e X-Yahoo-Newman-Property: ymail-3 From: David Brownell To: Linux MTD Subject: [patch 2.6.28-rc5] mtd m25p80: regression fix for chip detection Date: Mon, 17 Nov 2008 11:37:17 -0800 User-Agent: KMail/1.9.10 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200811171137.17431.david-b@pacbell.net> X-Spam-Score: 0.0 (/) Cc: Chen Gong , lkml X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: dbrownell@users.sourceforge.net 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: David Brownell The "m25p80.c extended jedec support" patch introduced a regression whereby every chip ended up matching the first entry in the list of chips, since it parenthesized a test incorrectly. This bug could cause MTD filesystem corruption, and all sorts crazy stuff since all chips would appear to be small (128KB) Atmel chips instead of what they really were. Signed-off-by: David Brownell Cc: Chen Gong --- drivers/mtd/devices/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/mtd/devices/m25p80.c +++ b/drivers/mtd/devices/m25p80.c @@ -574,10 +574,11 @@ static struct flash_info *__devinit jede for (tmp = 0, info = m25p_data; tmp < ARRAY_SIZE(m25p_data); tmp++, info++) { - if (info->jedec_id == jedec) + if (info->jedec_id == jedec) { if (ext_jedec != 0 && info->ext_id != ext_jedec) continue; return info; + } } dev_err(&spi->dev, "unrecognized JEDEC id %06x\n", jedec); return NULL;