Received: by 10.223.164.221 with SMTP id h29csp1962043wrb; Thu, 2 Nov 2017 03:49:15 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R3XA7jfWePeY08sbNkAopPQGZcJaohEOb4LzpATFg82U5q7STjtcoUre4KToJhUtmlBlpw X-Received: by 10.159.206.199 with SMTP id x7mr2790129plo.342.1509619755740; Thu, 02 Nov 2017 03:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509619755; cv=none; d=google.com; s=arc-20160816; b=MsbD0Nkfcs0GJ4AX3KcMDK/CiAbu/y2mo6W6oXWnSjvrFaLrGy62d5f9eoOALR7vTn er1MwOW88gF6dUik+k8dZsOV6PyS7UJDWZmxP/Uj7fGdEzHiALdSclS/GVZWUhgkfYGQ u2E3/CxqM7ESgjdEYuOWmOEB4x+PXAFunXqMh2qDTeK1tzQYysiwOTcBDUDR94KHZG4c c00G9G3+WcAJ6tYuUaOdHgV9M8hqPujJxDrbDQGteSLdYUOiI37rgLeJqZxZVdT+1WqU 69KrVMNhxFk/ozy+vuYqnkRVphxtJmYp1h5dadOU7xvznitA9+Wn3iVlsMVhPtHDZwJi h8Cg== 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=tXUd4p/3f0KRV0vpTcB4NF1tfNyjhEkpXyZXcNtH+ww=; b=YofX3MIPSSgCvm1qNPdrIsU0cAcwGbNJ1I8/IEueQQ5jqx5BWhw+6p4UANfnTqrBEl PJe2+a9NYaCmbQLdV1geVcouNmVWqY+v0mjVyTXCtjvSAUlZha/djptDiV0KCCqdwLDr Bc+BtEaAxpvsVm5aQj4PGgWYxfPqYAmtkNxajTGlMG3/x+s23k5A81zL0yReylqwyM4h aR9FQ3tAOdJ5B4oqOznmD6MT1RMo374FMOCiMdL8dvNLMdXQeXJr5auxAVL6MwQuLueZ MvSXmJ4jmRPTFl9CVjHgBzv4kMj44vtQDXNyWUxMOzVEEHnDRx8hLlIlzpwxDsSd/LEi rWBg== 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 n9si2165460pll.526.2017.11.02.03.49.02; Thu, 02 Nov 2017 03:49:15 -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 S1755519AbdKBKsT (ORCPT + 99 others); Thu, 2 Nov 2017 06:48:19 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:59921 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755467AbdKBKsS (ORCPT ); Thu, 2 Nov 2017 06:48:18 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id A881B212A2; Thu, 2 Nov 2017 11:48:16 +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 (91-160-177-164.subs.proxad.net [91.160.177.164]) by mail.free-electrons.com (Postfix) with ESMTPSA id 78CE0203A1; Thu, 2 Nov 2017 11:48:06 +0100 (CET) Date: Thu, 2 Nov 2017 11:48:06 +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: <20171102114806.5e33c153@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. > Applied. Thanks, Boris > Signed-off-by: Brent Taylor > --- > 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 1582767994007763886@xxx Tue Oct 31 10:19:44 +0000 2017 X-GM-THRID: 1582742523774112681 X-Gmail-Labels: Inbox,Category Forums