All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: linux-mtd@lists.infradead.org, Paul Mackerras <paulus@samba.org>,
	linuxppc-dev@lists.ozlabs.org, kernel@pengutronix.de
Subject: [PATCH 03/14] mtd: powernv_flash: Warn about failure to unregister mtd device
Date: Fri,  3 Jun 2022 23:07:47 +0200	[thread overview]
Message-ID: <20220603210758.148493-4-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20220603210758.148493-1-u.kleine-koenig@pengutronix.de>

mtd_device_unregister() shouldn't fail. Wail loudly if it does anyhow.

This matches how other drivers (e.g. nand/raw/nandsim.c) use
mtd_device_unregister().

By returning 0 in the platform remove callback a generic error message
by the device core is suppressed, nothing else changes.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/powernv_flash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 6950a8764815..36e060386e59 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -270,7 +270,9 @@ static int powernv_flash_release(struct platform_device *pdev)
 	struct powernv_flash *data = dev_get_drvdata(&(pdev->dev));
 
 	/* All resources should be freed automatically */
-	return mtd_device_unregister(&(data->mtd));
+	WARN_ON(mtd_device_unregister(&data->mtd));
+
+	return 0;
 }
 
 static const struct of_device_id powernv_flash_match[] = {
-- 
2.36.1


WARNING: multiple messages have this Message-ID (diff)
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: kernel@pengutronix.de,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	linux-mtd@lists.infradead.org, linuxppc-dev@lists.ozlabs.org
Subject: [PATCH 03/14] mtd: powernv_flash: Warn about failure to unregister mtd device
Date: Fri,  3 Jun 2022 23:07:47 +0200	[thread overview]
Message-ID: <20220603210758.148493-4-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20220603210758.148493-1-u.kleine-koenig@pengutronix.de>

mtd_device_unregister() shouldn't fail. Wail loudly if it does anyhow.

This matches how other drivers (e.g. nand/raw/nandsim.c) use
mtd_device_unregister().

By returning 0 in the platform remove callback a generic error message
by the device core is suppressed, nothing else changes.

This is a preparation for making platform remove callbacks return void.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/powernv_flash.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 6950a8764815..36e060386e59 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -270,7 +270,9 @@ static int powernv_flash_release(struct platform_device *pdev)
 	struct powernv_flash *data = dev_get_drvdata(&(pdev->dev));
 
 	/* All resources should be freed automatically */
-	return mtd_device_unregister(&(data->mtd));
+	WARN_ON(mtd_device_unregister(&data->mtd));
+
+	return 0;
 }
 
 static const struct of_device_id powernv_flash_match[] = {
-- 
2.36.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2022-06-03 21:09 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 21:07 [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Uwe Kleine-König
2022-06-03 21:07 ` Uwe Kleine-König
2022-06-03 21:07 ` Uwe Kleine-König
2022-06-03 21:07 ` Uwe Kleine-König
2022-06-03 21:07 ` Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 01/14] mtd: hyperbus: Make hyperbus_unregister_device() return void Uwe Kleine-König
2022-06-09 13:10   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 02/14] mtd: spi-nor: aspeed-smc: Make aspeed_smc_unregister() " Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-07  9:28   ` Pratyush Yadav
2022-06-07  9:28     ` Pratyush Yadav
2022-06-07  9:54     ` Cédric Le Goater
2022-06-07  9:54       ` Cédric Le Goater
2022-06-03 21:07 ` Uwe Kleine-König [this message]
2022-06-03 21:07   ` [PATCH 03/14] mtd: powernv_flash: Warn about failure to unregister mtd device Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 04/14] mtd: st-spi_fsm: " Uwe Kleine-König
2022-06-03 21:07 ` [PATCH 05/14] mtd: lpddr2_nvm: " Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 06/14] mtd: spear_smi: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 07/14] mtd: spear_smi: Drop if with an always false condition Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 08/14] mtd: rawnand: atmel: Warn about failure to unregister mtd device Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-06 13:16   ` Miquel Raynal
2022-06-06 13:16     ` Miquel Raynal
2022-06-06 19:37     ` Uwe Kleine-König
2022-06-06 19:37       ` Uwe Kleine-König
2022-06-07  6:14       ` Miquel Raynal
2022-06-07  6:14         ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 09/14] mtd: rawnand: omap2: Suppress error message after WARN in .remove() Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 10/14] mtd: rawnand: tegra: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 11/14] mtd: rawnand: meson: " Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 12/14] mtd: rawnand: meson: Drop cleaning platform data in .remove() Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-03 21:07   ` Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-09 13:09     ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 13/14] mtd: physmap: Don't skip cleanup after mtd_device_unregister() failed Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-03 21:07 ` [PATCH 14/14] mtd: physmap: Drop if with an always false condition Uwe Kleine-König
2022-06-09 13:09   ` Miquel Raynal
2022-06-06 13:18 ` [PATCH 00/14] mtd: Fix platform remove callbacks to always return 0 Miquel Raynal
2022-06-06 13:18   ` Miquel Raynal
2022-06-06 13:18   ` Miquel Raynal
2022-06-06 13:18   ` Miquel Raynal
2022-06-06 13:18   ` Miquel Raynal
2022-06-07  9:32   ` Pratyush Yadav
2022-06-07  9:32     ` Pratyush Yadav
2022-06-07  9:32     ` Pratyush Yadav
2022-06-07  9:32     ` Pratyush Yadav
2022-06-07  9:32     ` Pratyush Yadav
2022-06-07 10:47     ` Miquel Raynal
2022-06-07 10:47       ` Miquel Raynal
2022-06-07 10:47       ` Miquel Raynal
2022-06-07 10:47       ` Miquel Raynal
2022-06-07 10:47       ` 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=20220603210758.148493-4-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=richard@nod.at \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.