From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: <linux-mtd@lists.infradead.org>,
Richard Weinberger <richard@nod.at>,
Marek Vasut <marek.vasut@gmail.com>,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Subject: Re: [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer
Date: Tue, 2 May 2017 09:15:53 +0200 [thread overview]
Message-ID: <20170502091553.7d666a50@bbrezillon> (raw)
In-Reply-To: <20170502000455.13240-2-computersforpeace@gmail.com>
On Mon, 1 May 2017 17:04:51 -0700
Brian Norris <computersforpeace@gmail.com> wrote:
> It makes sense to do this in nand_base.
>
> (Alternatively: we don't really need to do this at all.)
Actually, I was just trying to handle a potential 'double-free' error
nicely (see the 'if (hynix) return;' statement at the beginning of
hynix_nand_cleanup(), but I'm not sure this was a good idea.
Let's drop this assignment.
>
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> 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)
next prev parent reply other threads:[~2017-05-02 7:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-02 0:04 [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Brian Norris
2017-05-02 0:04 ` [PATCH] mtd: nand: don't make vendor-specific code un-set their data pointer Brian Norris
2017-05-02 7:15 ` Boris Brezillon [this message]
2017-05-02 0:04 ` [PATCH] mtd: nand: drop unneeded module.h include Brian Norris
2017-05-02 7:16 ` Boris Brezillon
2017-05-15 20:50 ` Boris Brezillon
2017-05-02 0:04 ` [PATCH] mtd: nand: free vendor-specific resources in init failure paths Brian Norris
2017-05-02 7:52 ` Boris Brezillon
2017-05-02 16:15 ` Boris Brezillon
2017-05-15 20:49 ` Boris Brezillon
2017-05-02 0:04 ` [PATCH] mtd: nand: orion: don't complain for probe deferral Brian Norris
2017-05-02 7:56 ` Boris Brezillon
2017-05-02 8:07 ` Simon Baatz
2017-05-08 17:46 ` Brian Norris
2017-05-02 0:04 ` [PATCH] mtd: nand: samsung: warn about un-parseable ECC info Brian Norris
2017-05-02 7:57 ` Boris Brezillon
2017-05-15 20:48 ` Boris Brezillon
2017-05-02 0:22 ` [PATCH] mtd: nand: don't leak buffers when ->scan_bbt() fails Ezequiel Garcia
2017-05-02 1:33 ` Brian Norris
2017-05-02 2:21 ` Ezequiel Garcia
2017-05-02 7:17 ` Boris Brezillon
2017-05-15 20:50 ` Boris Brezillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170502091553.7d666a50@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox