From patchwork Tue May 2 00:04:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 757357 X-Patchwork-Delegate: computersforpeace@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wH1lp2QDXz9sNF for ; Tue, 2 May 2017 10:05:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Av29lwBf"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cHrPZkw+"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=CtQ25F/Ig6G/gmjlgAgHgCP+Xs6qqlua3PSBJF8/x6U=; b=Av29lwBftHOwVo5qreLMbQ4N2O hA0juq/xYc3PCyRvOy+HXVXXXktCTT6563mD4e0cDXJ6VnlPMnANjN4Eu+WtycDiZbU3h9tI0B3dV 5Ae+TNRb3/kiG7NPH1Pz+SGambLqlutBevay71uWgNoJtWbmnwauvYu5l1kqhURkSmAJO4JPNK86M fH4KIdXQZ8Ts8g3/hExhf3/pi2VrFSp3KSXTZ32mAa1k+r5XSzXv5Iy9S3qi4BVgHKnpyPJeZsf0z ia0tJV492LsMWUDNfmUjDRXJHTgmZOA844H8aQ3HOm5NZJspMTctV1BYl09TFZHNfftc0r/SUF+iV KOXy0UMw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1d5LKB-0002Po-K4; Tue, 02 May 2017 00:05:51 +0000 Received: from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1d5LJm-0001aW-U0 for linux-mtd@lists.infradead.org; Tue, 02 May 2017 00:05:29 +0000 Received: by mail-pg0-x244.google.com with SMTP id c2so7766932pga.2 for ; Mon, 01 May 2017 17:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ATihkmBW1zeCh3qyRmkuPaAvMIVskCwYL/CsiD2EZ3Y=; b=cHrPZkw+5fp5BVOL2j63oSlu8EyUf3zZboKTPrndEpyFjwNjsqDD+Nlzl6m0oi4V3b HeF5iXpeM2Nboxs37nwSCtKzmR0xWikHf0fNhZbVE23bxNH98bbtNJQXorAUZd2E5ubF fM0Xv0k6VOUlsf1QwFJTr2BLTlR251GdqWtA9Dd1/ZNLDFRbAIXr+VwbkiX/6QlvNi38 xOx2I0GR92myPsC1u9dO6Tker0DzXHNf2Pr6lFgF6inHU4TenQJGxVGVW14jnOq3rxiB PTpFYf6TtFmRfvm6I5pi+RAif4UkzxI80gt2cAzz+FJ6cGWjVpdPcENn5GpwyiwQ6D89 dzMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ATihkmBW1zeCh3qyRmkuPaAvMIVskCwYL/CsiD2EZ3Y=; b=HiNeVfJ9SRpVdfqjD3hwMQ/glx7zJ7h+5+p82+2ihuZYdbXBiIAWJiYMCTkUtj9Gmo jhuYoiYxCof6iGmzJWpJGxKBxkluXtqAvceJqRuX2nasS5DbBU/mlB1BkbLZRGwDD/Fi WVwHsECYsdGGzw+imsnZl2QomB/n7nRyHsBC9wdiS7kAtDChPWU7FvjqrYnrN9bM3GpU iluX33KfHHvx6JjbEZkqVUuJJCt55GBz4jUDcxPAv4HDHgPCmjmfpi1fwwOOlaMJKMNJ WNJNSUK9nM7zl6e5PLVN4aYboDntqw8TpKb9G17slnjeF3dskuknxtcoc7Zg1v+l+oFt AOkg== X-Gm-Message-State: AN3rC/6UjErr+DzbkSap1zQL9tJ0kzQlyOxi1vieMB2yBnqvJ1rNKQVc vIr3PItlyrfyQ2lj X-Received: by 10.98.76.140 with SMTP id e12mr28754999pfj.128.1493683506002; Mon, 01 May 2017 17:05:06 -0700 (PDT) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id g22sm26756413pfd.22.2017.05.01.17.05.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 May 2017 17:05:05 -0700 (PDT) From: Brian Norris To: , Boris Brezillon Subject: [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer Date: Mon, 1 May 2017 17:04:51 -0700 Message-Id: <20170502000455.13240-2-computersforpeace@gmail.com> X-Mailer: git-send-email 2.13.0.rc1.294.g07d810a77f-goog In-Reply-To: <20170502000455.13240-1-computersforpeace@gmail.com> References: <20170502000455.13240-1-computersforpeace@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170501_170526_996122_FD7ADF30 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:244 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cyrille Pitchen , Richard Weinberger , Brian Norris , Marek Vasut MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org It makes sense to do this in nand_base. (Alternatively: we don't really need to do this at all.) Signed-off-by: Brian Norris --- Compile tested only drivers/mtd/nand/nand_base.c | 11 +++++++++-- drivers/mtd/nand/nand_hynix.c | 1 - 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ed49a1d634b0..2adcc8cdedf1 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -3910,11 +3910,16 @@ static void nand_manufacturer_detect(struct nand_chip *chip) */ static int nand_manufacturer_init(struct nand_chip *chip) { + int ret; + if (!chip->manufacturer.desc || !chip->manufacturer.desc->ops || !chip->manufacturer.desc->ops->init) return 0; - return chip->manufacturer.desc->ops->init(chip); + ret = chip->manufacturer.desc->ops->init(chip); + if (ret) + nand_set_manufacturer_data(chip, NULL); + return ret; } /* @@ -3927,8 +3932,10 @@ static void nand_manufacturer_cleanup(struct nand_chip *chip) { /* Release manufacturer private data */ if (chip->manufacturer.desc && chip->manufacturer.desc->ops && - chip->manufacturer.desc->ops->cleanup) + chip->manufacturer.desc->ops->cleanup) { chip->manufacturer.desc->ops->cleanup(chip); + nand_set_manufacturer_data(chip, NULL); + } } /* diff --git a/drivers/mtd/nand/nand_hynix.c b/drivers/mtd/nand/nand_hynix.c index b12dc7325378..54d99f90aa9f 100644 --- a/drivers/mtd/nand/nand_hynix.c +++ b/drivers/mtd/nand/nand_hynix.c @@ -598,7 +598,6 @@ static void hynix_nand_cleanup(struct nand_chip *chip) kfree(hynix->read_retry); kfree(hynix); - nand_set_manufacturer_data(chip, NULL); } static int hynix_nand_init(struct nand_chip *chip)