From: Matthias Brugger <matthias.bgg@kernel.org>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Pratyush Yadav <pratyush@kernel.org>,
Michael Walle <michael@walle.cc>,
linux-mtd@lists.infradead.org
Cc: AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-arm-kernel@lists.infradead.org,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH next 1/2] mtd: rawnand: mtk: Factorize out the logic cleaning mtk chips
Date: Fri, 6 Sep 2024 17:01:28 +0200 [thread overview]
Message-ID: <3665154b-6794-4f65-bcd6-ca53f06d1422@kernel.org> (raw)
In-Reply-To: <20240826153019.67106-1-miquel.raynal@bootlin.com>
On 26/08/2024 17:30, Miquel Raynal wrote:
> There are some un-freed resources in one of the error path which would
> benefit from a helper going through all the registered mtk chips one by
> one and perform all the necessary cleanup. This is precisely what the
> remove path does, so let's extract the logic in a helper.
>
> There is no functional change.
>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Matthias Brugger <matthias.bgg@kernel.org>
> ---
> drivers/mtd/nand/raw/mtk_nand.c | 31 ++++++++++++++++++-------------
> 1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
> index d65e6371675b..bf845dd16737 100644
> --- a/drivers/mtd/nand/raw/mtk_nand.c
> +++ b/drivers/mtd/nand/raw/mtk_nand.c
> @@ -1429,6 +1429,23 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
> return 0;
> }
>
> +static void mtk_nfc_nand_chips_cleanup(struct mtk_nfc *nfc)
> +{
> + struct mtk_nfc_nand_chip *mtk_chip;
> + struct nand_chip *chip;
> + int ret;
> +
> + while (!list_empty(&nfc->chips)) {
> + mtk_chip = list_first_entry(&nfc->chips,
> + struct mtk_nfc_nand_chip, node);
> + chip = &mtk_chip->nand;
> + ret = mtd_device_unregister(nand_to_mtd(chip));
> + WARN_ON(ret);
> + nand_cleanup(chip);
> + list_del(&mtk_chip->node);
> + }
> +}
> +
> static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)
> {
> struct device_node *np = dev->of_node;
> @@ -1567,20 +1584,8 @@ static int mtk_nfc_probe(struct platform_device *pdev)
> static void mtk_nfc_remove(struct platform_device *pdev)
> {
> struct mtk_nfc *nfc = platform_get_drvdata(pdev);
> - struct mtk_nfc_nand_chip *mtk_chip;
> - struct nand_chip *chip;
> - int ret;
> -
> - while (!list_empty(&nfc->chips)) {
> - mtk_chip = list_first_entry(&nfc->chips,
> - struct mtk_nfc_nand_chip, node);
> - chip = &mtk_chip->nand;
> - ret = mtd_device_unregister(nand_to_mtd(chip));
> - WARN_ON(ret);
> - nand_cleanup(chip);
> - list_del(&mtk_chip->node);
> - }
>
> + mtk_nfc_nand_chips_cleanup(nfc);
> mtk_ecc_release(nfc->ecc);
> }
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2024-09-06 15:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-26 15:30 [PATCH next 1/2] mtd: rawnand: mtk: Factorize out the logic cleaning mtk chips Miquel Raynal
2024-08-26 15:30 ` [PATCH next 2/2] mtd: rawnand: mtk: Fix init error path Miquel Raynal
2024-09-04 14:08 ` Pratyush Yadav
2024-09-04 14:25 ` Miquel Raynal
2024-09-06 15:01 ` Matthias Brugger
2024-09-06 15:02 ` Miquel Raynal
2024-09-04 14:15 ` [PATCH next 1/2] mtd: rawnand: mtk: Factorize out the logic cleaning mtk chips Pratyush Yadav
2024-09-06 15:01 ` Matthias Brugger [this message]
2024-09-06 15:02 ` Miquel Raynal
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=3665154b-6794-4f65-bcd6-ca53f06d1422@kernel.org \
--to=matthias.bgg@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=michael@walle.cc \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=thomas.petazzoni@bootlin.com \
--cc=tudor.ambarus@linaro.org \
--cc=vigneshr@ti.com \
/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