Received: by 10.223.164.221 with SMTP id h29csp3687851wrb; Tue, 31 Oct 2017 03:19:45 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TlR4JAZAxlmdHUs4jmYWZLocg2NK4w85L9UaE8kudlYx+s1oPEym7Cyq7u5X75P0UD+pBh X-Received: by 10.101.98.131 with SMTP id f3mr1363589pgv.366.1509445184944; Tue, 31 Oct 2017 03:19:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509445184; cv=none; d=google.com; s=arc-20160816; b=WUW0YuGR1A24OE7XJMDLqBPNJeEsR2Z1bi3Fur9IfHsFJyxH/uAzPf4tfctPnSaEaK hHkwq5XNzNT+CtpN5IfGwJqxJmqydurES9y6oWfvoIiWLymMPWSQ1KgJwXJzhhKUPqWV IdZKOkTRutuHDx/ry0iW9XndmrKRbLe4DkHjkJI508xnZOwnXQn9MNlV5q+7HX16UneE 5cethxKvlL7UjNpI6c7V31xc4xdxjHjF87P0oeQ6EIh2keJomybFQ5W8sEf0iS1i0QS9 opP4jHpfywmY/joLaOzHD6DcCrv8HKgCTzwJt1SaIcOCyJBf5/FjT7sZI2JXZuZkvPVz upxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=9mFZXPe7eg13JizN1LUDLuHbWvvDB3/lZ7WzBT3lFYk=; b=r3HuiZduXYo2Ecigq1Z4qVqsMSoFlotGvradWE3XAznYseCOGQ+BqNSoDzaozASkkw /4TB9w8At4KO0Y4LMWrh3MfBKffZ8WtLi/Oehp50VFINDB9pG1j1QDCzMBVCnJTnt46G RW2AkA91g2ks60F4Iwsi7ZbMSOHrXqsSHfn7sr59FDhTyRHsvYwa+eLCebQct2eNvezy 5PgO6sOyFuzeDEBaX8imJZ2tOgajgc6j3zmQa0dz+FnkfKQIufVgA1IKEta6UaPSFbrA jiWYG2eJkUEc+OiXSl3NWGezsYK8nfI+s4b0hJwoRaswU79bEJLCZCiKlmFeIoatVF/a zWrQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i128si1314311pfg.17.2017.10.31.03.19.32; Tue, 31 Oct 2017 03:19:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932364AbdJaKS6 (ORCPT + 99 others); Tue, 31 Oct 2017 06:18:58 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:50995 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932289AbdJaKSy (ORCPT ); Tue, 31 Oct 2017 06:18:54 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id 7B66B21D56; Tue, 31 Oct 2017 11:18:51 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 3CB3621D43; Tue, 31 Oct 2017 11:18:41 +0100 (CET) Date: Tue, 31 Oct 2017 11:18:42 +0100 From: Boris Brezillon To: motobud@gmail.com Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mtd: nand: Fix writing mtdoops to nand flash. Message-ID: <20171031111842.6b42ed23@bbrezillon> In-Reply-To: <20171031033246.8576-1-motobud@gmail.com> References: <20171030042343.24551-1-motobud@gmail.com> <20171031033246.8576-1-motobud@gmail.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Oct 2017 22:32:45 -0500 motobud@gmail.com wrote: > From: Brent Taylor > > When mtdoops calls mtd_panic_write, it eventually calls > panic_nand_write in nand_base.c. In order to properly > wait for the nand chip to be ready in panic_nand_wait, > the chip must first be selected. > > When using the atmel nand flash controller, a panic > would occur due to a NULL pointer exception. > > Signed-off-by: Brent Taylor I'll add Fixes: 2af7c6539931 ("mtd: Add panic_write for NAND flashes") Cc: when applying the patch. Thanks, Boris > --- > Changes in v2: > - drop deselecting the chip > - move select_chip and panic_nand_wait after panic_nand_get_device > > drivers/mtd/nand/nand_base.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index 12edaae17d81..2093667e2bcb 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -2802,12 +2802,16 @@ static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len, > struct mtd_oob_ops ops; > int ret; > > - /* Wait for the device to get ready */ > - panic_nand_wait(mtd, chip, 400); > + int chipnr = (int)(to >> chip->chip_shift); > > /* Grab the device */ > panic_nand_get_device(chip, mtd, FL_WRITING); > > + chip->select_chip(mtd, chipnr); > + > + /* Wait for the device to get ready */ > + panic_nand_wait(mtd, chip, 400); > + > memset(&ops, 0, sizeof(ops)); > ops.len = len; > ops.datbuf = (uint8_t *)buf; From 1582742523774112681@xxx Tue Oct 31 03:34:54 +0000 2017 X-GM-THRID: 1582742523774112681 X-Gmail-Labels: Inbox,Category Forums